User Control Panel
Advertisements

HELP US, HELP YOU!

Checking file size for change, act when occurs

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
weizbox
Newbie
Newbie


Joined: 31 Mar 2005
Posts: 4

Reputation: 13.5

PostPosted: Thu Mar 31, 2005 8:17 pm    Post subject: Reply with quote

Hi everyone,
Im pretty new to perl, and as well, bots. I was wondering what would be the best method for an aimbot to read a text file, and basicly know when it has changed, and on change then react to it (I know enough perl to do the reaction part). I downloaded the base bot, and have gotten it to do things such as reply and whatnot, but Im trying to get it to trigger on another program of mine that writes to a text file, and when this occurs, find a username in teh text file, accociate username with aim sn, and message user with some of the info in the file that just changed. As far as getting the info out of the file and comparing against a list to see what they're screen name is, I think I can do. The part I dont know about is to know when a file has been modified (overwritten by the other app). This change can occur whenever, theres no set time... so I was thinking of something along teh lines of checking every second or so to see if theres a change. Any ideas of links to put me in the right direction?

Many Thanks,
Weizbox Very Happy
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Mar 31, 2005 10:12 pm    Post subject: Reply with quote

To get the last modified time of a file, do:

Code:
$modified = stat($filename)[9];


So like...
Code:
# Starting point.<br />my $modified = stat('file.txt')[9];<br /><br />#..... file is modified .....<br /><br /># See if the file is modified.<br />if (stat('file.txt')[9] > $modified) {<br />   # do stuff<br />}

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
weizbox
Newbie
Newbie


Joined: 31 Mar 2005
Posts: 4

Reputation: 13.5

PostPosted: Thu Mar 31, 2005 11:01 pm    Post subject: Reply with quote

Ah, thank you... but any idea where in the basebot this would be placed to still include being able to reaspond to IMs, etc? Im using the base-bot model at the moment and just making a few changes here and there.

Thanks!
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Thu Mar 31, 2005 11:33 pm    Post subject: Reply with quote

You could get the original modified date of the file before the bot goes on the while(1) loop, and then put the other stuff inside that loop:

[CODE]# this is where the getting $modified would go

while (1) {
$msn->do_one_loop();

# this is where the comparing would go
}

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
weizbox
Newbie
Newbie


Joined: 31 Mar 2005
Posts: 4

Reputation: 13.5

PostPosted: Thu Mar 31, 2005 11:40 pm    Post subject: Reply with quote

ah ha... Im using the aimbot at the moment and noticed the aim->start at the bottom but had no idea how that would do anything at all.. so im going to try and replace it with what you put down, switching msn for aim, and from there it looks like im good.

Thanks again! much appreciated in the start of this learning curve.
Weizbox
Back to top
weizbox
Newbie
Newbie


Joined: 31 Mar 2005
Posts: 4

Reputation: 13.5

PostPosted: Fri Apr 01, 2005 1:34 am    Post subject: Reply with quote

Hi,
I just got my script written up for testing and the first error I got was a syntax error on the same line where i put

$modified = stat($filename)[9];

syntax error at bot.pl line 94, near ")["

as you know, im kinda a noob so not sure if i was supposed to put down that [9] differntly or what... but Im looking into it to try to see what I can find online to get it up and running.

Weizbox
Back to top
malefactor
Member
Member


Joined: 27 Jan 2005
Posts: 109
Location: Lewiston, ME
Reputation: 17.7Reputation: 17.7

PostPosted: Sat Apr 02, 2005 5:26 pm    Post subject: Reply with quote

I always use an array ->

@filestats = stat($filename);
$modified = @filestats[9];

perhaps you should try that
Back to top
Cer
Upgraded Agent
Upgraded Agent


Joined: 03 Feb 2004
Posts: 3776
Location: Michigan
Reputation: 146.9
votes: 4

PostPosted: Sat Apr 02, 2005 6:53 pm    Post subject: Reply with quote

Aha, the one I gave you was missing a pair of parenthesis.

Code:
my $modified = (stat('Leviathan.pl'))[9];


I just tested it, that one works (of course replace 'Leviathan.pl' with $filename or whatever file you're checking Razz ).

_________________
Current Site (2008) http://www.cuvou.com/
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group