Sign in to follow this  
Followers 0
Caml Light

CMD Batch: Get Time

18 posts in this topic

At some point you have to realize batch files are 1980's best (MS-DOS era technology, before Windows even existed) and as such are severely limited. It's much easier to do this kind of stuff using any other language or scripting language. For starters, batch files don't have a native way to scrape web pages like that, and it's also quite a pain dealing with dates in batch files due to regional formatting differences. At some point you're better off moving to a more modern technology than batch files.

0

Share this post


Link to post
Share on other sites

The variable %date% should do.

0

Share this post


Link to post
Share on other sites

The variable %date% should do.

Not quite:

I need to get the correct date from Internet

0

Share this post


Link to post
Share on other sites

Compile your autoit script as console application so as to interact with whatever batch command you have in mind.

Why need to do it with a CMD batch....?

Edited by Geej
0

Share this post


Link to post
Share on other sites

Indeed i was wrong and to make it in pure batch would need external exe (at least wget or equivalent ) and Geej is right about compile the autoit as console if needed (as the autoit code is only a function, you'll need to add the output part that will call the function).

Also i don't understand at all why you'd want to get the date from internet (and if it's for a software protection of some kind, this won't be reliable at all as everyone can just add nist.time.gov in their hosts file and create a fake web page with any date) and making it in batch would only make it weaker.

0

Share this post


Link to post
Share on other sites

Philosophical considerations set apart, here:

http://www.softpedia.com/get/Desktop-Enhancements/Clocks-Time-Management/Cmdtime.shtml

(already invented wheel)

Or check the use of W32TM.EXE....

Also, it depends on the accuracy you need/want, since you want "day" resolution you can use also httpget.:

http://www.willus.com/archive/

or curl or wget and download a page such as:

http://www.time.gov/timezone.cgi?UTC/s/0/

and parse it

jaclaz

0

Share this post


Link to post
Share on other sites

hi guys, thanks for your replies! I need it to protect my software. So, what's the best method for you?

0

Share this post


Link to post
Share on other sites

hi guys, thanks for your replies! I need it to protect my software. So, what's the best method for you?

If your "software" (or it's protection method) is written in batch (or any plain text, interpreted language) a five years old, blind-folded and with BOTH arms tied behind his/her back can crack it faster than you can say "Jack":

http://en.wikipedia.org/wiki/Jack_(tree)

(or "mango" for that matters), let alone "Jack Robinson":

http://en.wikipedia.org/wiki/Jack_Robinson_(mythical_person)

:lol:

jaclaz

0

Share this post


Link to post
Share on other sites

thank you for your sarcarm :), but i need a method to block my software after a period of time. I can use a text file on my server to check the expiration time, but it works only if the date on the computer that runs my software is correct.

Any ideas (not sarcastic)?

0

Share this post


Link to post
Share on other sites

thank you for your sarcarm

Yet, there's insight hiding in there. A protection written in batch will only get in the way of complete n00bs.

Any ideas (not sarcastic)?

I might be repeating myself here, but I'd start by not using batch files. Then again it's very easy recreating whatever a batch file can accomplish from scratch (in a few minutes) so I wouldn't worry so much about protecting it in the first place. Your call...

0

Share this post


Link to post
Share on other sites

As CoffeeFiend hinted, I masked with sarcasm some IMHO good advice, which (the advice I mean, not the joking remark I made) should be taken SERIOUSLY .

Now, the following are facts:

  1. there is NO "UNcrackable" software protection based on software[1]
  2. there is NOT EVEN ANY "UNcrackable" software protection based on hardware[1]
  3. having the app checking from a batch (or any plain-text interpreted language) a date on the internet is VERY EASILY crackable
  4. having the app sending a "challenge code" (encrypted) to a given site in order to receive an (encrypted) "authentication code" might seem a better idea, but it is NOT (generally speaking) a very good idea[2]

[1] It all depends on how valuable is your software and the amount of time and resources one is willing to dedicate to it's cracking. (ANYTHING created by man can be re-created by another man)

[2] Say that you have a (temporary) failure (of *any* kind) of your server, guess WHICH software your customers will decide to throw in the dumpbin as soon as they find out that the software they bought isn't working when they need it? Are you prepared to deal with a few tens/hundreds/thousands/zillions angry customers?

Of course if you don't care about your customers' satisfaction with your software, go ahead with your "server" approach. :thumbup

There are companies that make money by selling to other developers a protection tool, software, or hardware, or Internet based (which BTW is regularly cracked, sooner or later, at each release), do you really think you can do something better than that? (and with batch files? :w00t:)

BTW, if you think so, you are wrong :ph34r:, by definition of CATCH22:

http://en.wikipedia.org/wiki/Catch-22_(logic)

  • If you know how to create a safe protection, you don't ask for help on a forum about it..
  • If you ask for help on a forum about it you don't know how to create it.

MInd you I am not trying to put you down or anything like that :), I am simply trying to help you being in contact with reality.

jaclaz

0

Share this post


Link to post
Share on other sites

Ok, i can forget batch files... but, what do you suggest me?

There are a variety of programming langauges that you could use.

Myself I can write in VBS and Vb.net ok, understand Java Script

You could also do a Google or Bing Search in C programming .

0

Share this post


Link to post
Share on other sites

Nowadays the only good protections are online one's and without any executable available on the client side and this is a little expensive to setup but not really complex:

- you setup a secured/hardened server

- configure your application on this server with any protection or a minimal one (like checking the partition signature).

- allow users with very restricted rights to access and run your application on the server.

The worst case could be that someone find a way to hack your server.

0

Share this post


Link to post
Share on other sites

but, what do you suggest me?

You mean, totally without knowing what you're trying to do or for what purpose, your skill level (with computers in general, or at scripting/programming) , languages you might know, your preferences, what resources (time, money or otherwise) are available, who the end user is, what platform(s) it should run onto, performance goals you might have, what support you may need, features you require, etc?

I might as well recommend a banana then. That's the thing with guessing based on no information whatsoever. The results tend to suck.

It's a bit like asking "pick a vehicle for me", without knowing if it needs to fly, float, carry cargo, budget limits or anything like that. You need a bit of infos first, before you can actually make any sensible recommendations.

Not even knowing what kind of thing it's meant to protect I'm not sure you're not totally wasting your time in the first place. It could be something as trivial as this for all we know, which TONS of people could easily write from scratch in a variety of languages in less than 5 minutes anyway (or perhaps find other tools that do the same thing but without restrictions). There's no point in even wasting time protecting something simple like that. Then again, I have absolutely no idea what you're working onto here so I might be completely off.

0

Share this post


Link to post
Share on other sites

I might as well recommend a banana then.

Suddenly....

4kfr1k1tmz.jpg

:lol:

jaclaz

0

Share this post


Link to post
Share on other sites

I would assume you are running a version of Windows server for your software registration process so if that's the case, depending on the version of Windows Server you are running; I would look into using the following:

net time /setsntp:pool.ntp.org

or W32TM as was mentioned in an earlier thread here. Either will work just make sure your firewall is set to allow UDP traffic port 123.

Good luck.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.