Sign in to follow this  
Followers 0
lobstersim

possible to set a time to auto execute a script?

4 posts in this topic

hi

is it possible to set a time to auto execute a script? B)

thanks in advance!

Share this post


Link to post
Share on other sites



hi! sure it is posible!

so you have 2 solution!

1 you make a script who will run 24/24 and start you app at desired time! if it is your solution i sugest you put your script in service mode with svrany.exe.

2 you use the sheduler in windows system or in the shell with command AT

a long time a go i made a script who run as service and check for process exist if not it start it!

and he check for the process exist at a time interval you select between 1 seconde and ilimited. maybe it can help to start! this is the help file i do with the code

Le Fichier INI dois etre a la meme place que le ckps.exe

les champs dans le fichier doivent etre encrypté avec

l'encrypteur au level 2 et le password: 12345

une fois bien configurer simplement lancer ckps.exe

pour quitter vous devez killer le process ou terminer le service dependament la facon

que vous lavez demarre.

le maximun de processu a verifier en meme temps est de 15

le maximun de commands ftp est de 50

Un Log sera cree sous ckps.log

[pr0cess1]et 2 et 3 et 4 et ...

pr0cess=le process a examiner

pr0gram=la command a excuter avec le path ex: c:\windows\allo.exe

time= temps en seconde pour verifier le process ex: 86400 qui donne 24 heure

ftpm0de= 1 ou 0

[ftpc0nfig1] et 2 et 3 et 4 et ...

h0st=le ip du host ex: 127.0.0.1

p0rt=le port du remote host ex: 21

user= ton username

pass=ton password

[ftpc0mmands1] et 2 et 3 et 4 et ...

c0mmand1=une command a envoyer au ftp ex: site bot

c0mmand2=maximun de 49 commands

C0mmand3=la command 50 ou la derniere dois demeurrer QUIT pour quiter de facon correct

c0mmand4=

c0mmand5=

c0mmand6=

c0mmand7=

c0mmand8=

c0mmand9=

c0mmand10=

c0mmand11=

c0mmand12=

c0mmand13=

c0mmand14=

c0mmand15=

c0mmand50=

as you see it can start process by ftp command!

it why everthing is encrypted!

this is the code

#include "ftpcommand.au3"
#include "_encrypteur.au3"
#include <string.au3>
#include <file.au3>
#region opt and variable
Opt("CaretCoordMode", 1)       ;1=absolute, 0=relative
Opt("ExpandEnvStrings", 0)   ;0=don't expand, 1=do expand
Opt("MouseClickDelay", 10)   ;10 milliseconds
Opt("MouseClickDownDelay", 10) ;10 milliseconds
Opt("MouseClickDragDelay", 250);250 milliseconds
Opt("MouseCoordMode", 1)       ;1=absolute, 0=relative
Opt("MustDeclareVars", 0)     ;0=no, 1=require pre-declare
Opt("PixelCoordMode", 1)       ;1=absolute, 0=relative
Opt("RunErrorsFatal", 0)       ;1=fatal, 0=silent set @error
Opt("SendAttachMode", 0)       ;0=don't attach, 1=do attach
Opt("SendCapslockMode", 1)   ;1=store and restore, 0=don't
Opt("SendKeyDelay", 8)       ;5 milliseconds
Opt("SendKeyDownDelay", 1)   ;1 millisecond
Opt("TrayIconDebug", 0)     ;0=no info, 1=debug line info
Opt("TrayIconHide", 1)       ;0=show, 1=hide tray icon
Opt("WinWaitDelay", 500)       ;250 milliseconds
Opt("WinDetectHiddenText", 0)  ;0=don't detect, 1=do detect
Opt("WinSearchChildren", 1) ;0=no, 1=search children also
Opt("WintitleMatchMode", 1) ;1=start, 2=subStr, 3=exact, 4=...
#endregion

;_encryption(1,$_text,$_password, $_level)
;_decryption(0,$_text,$_password, $_level)
;~ Usage _openconnection("Host","User","Password", Type)
;~ Type = $FTP_TRANSFER_TYPE_ASCII or $FTP_TRANSFER_TYPE_BINARY
;~ return the connection number

;~ Usage _sendcommand("connectionnumber","command")
;~ return ???

;~ Usage _closeconnection("connectionnumber")
;~ return ???

;~ exemple
;~ global $INTERNET_DEFAULT_FTP_PORT = 21210
;~ $cNumber = _openconnection("127.0.0.1","anonymous","allo@bouda.com",$FTP_TRANSFER_TYPE_ASCII)
;~ sleep(5000)
;~ _sendcommand($cNumber,"salut gros pachat")
;~ _closeconnection($cNumber)
;global $_timerinit = timerinit()
;global $tempsecouler
global $_logfile = "ckps.log"
global $nombredeprocess
global $_ini = "ckps.ini"
_FileWriteLog($_logfile, "************************************************DEBUT*******************************************

*******")
if not FileExists("ckps.ini") then
    fileinstall("c:\inwork\ckps\ckps.ini", "ckps.ini", 1)
endif


$_inisections = IniReadSectionNames($_ini)
;MsgBox(262144,'Debug line ~54','Selection:' & @lf & '$_inisections' & @lf & @lf & 'Return:' & @lf & $_inisections[5] & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX

for $ix = 1 to $_inisections[0]
    if not StringInStr($_inisections[$ix],"pr0cess" & $ix,1) then exitloop
    $nombredeprocess = $nombredeprocess + 1
;~  MsgBox(262144,'Debug line ~58','Selection:' & @lf & '$nombredeprocess' & @lf & @lf & 'Return:' & @lf & $nombredeprocess & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX
next

;exit
Dim $_process[$nombredeprocess+1]
Dim $_program[$nombredeprocess+1]
Dim $_time[$nombredeprocess+1]
Dim $_ftpmode[$nombredeprocess+1]
Dim $_thost[$nombredeprocess+1]
Dim $_tport[$nombredeprocess+1]
Dim $_tuser[$nombredeprocess+1]
Dim $_tpass[$nombredeprocess+1]
Dim $_timerinit[$nombredeprocess+1]

for $ix = 1 to $nombredeprocess
    $_timerinit[$ix] = timerinit()
next    

for $ix = 1 to $nombredeprocess
        $_process[$ix] = _decryption(0,IniRead ( $_ini, "pr0cess" & $ix, "pr0cess", ""),"12345", 2) 
;~      MsgBox(262144,'Debug line ~76','Selection:' & @lf & '$_process' & @lf & @lf & 'Return:' & @lf & $_process[$ix] & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX
        $_program[$ix] = _decryption(0,IniRead ( $_ini, "pr0cess" & $ix, "pr0gram", ""),"12345", 2)
        $_time[$ix] = _decryption(0,IniRead ( $_ini, "pr0cess" & $ix, "time", ""),"12345", 2)   
        $_ftpmode[$ix] = _decryption(0,IniRead ( $_ini, "pr0cess" & $ix, "ftpm0de", ""),"12345", 2)
        $_thost[$ix] = _decryption(0,IniRead ( $_ini, "ftpc0nfig" & $ix, "h0st", ""),"12345", 2)
        $_tport[$ix] = _decryption(0,IniRead ( $_ini, "ftpc0nfig" & $ix, "p0rt", ""),"12345", 2)
        $_tuser[$ix] = _decryption(0,IniRead ( $_ini, "ftpc0nfig" & $ix, "user", ""),"12345", 2)
        $_tpass[$ix] = _decryption(0,IniRead ( $_ini, "ftpc0nfig" & $ix, "pass", ""),"12345", 2)
next
for $ix = 1 to $nombredeprocess
    _FileWriteLog($_logfile,"ProcessCheck-"&$ix&": "& $_process[$ix])
    _FileWriteLog($_logfile,"ProcessCheckRun-"&$ix&": "& $_program[$ix])
    _FileWriteLog($_logfile,"ProcessCheckFTPmode-"&$ix&": "& $_ftpmode[$ix])
next        

;exit   
while 1
    sleep (500)
        For $ix = 1 to $nombredeprocess
            Global $INTERNET_DEFAULT_FTP_PORT = $_tport[$ix]
        ;MsgBox(262144,'Debug line ~95','Selection:' & @lf & '$_process' & @lf & @lf & 'Return:' & @lf & $_process[$ix] & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX           
            if $_process[$ix] = "" then 
                _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---Process = NUL-----ERROR")
                exitloop
            endif
            sleep (500)
            if int(Timerdiff($_timerinit[$ix])/1000) / $_time[$ix] >= 1 then
                if $_ftpmode[$ix] = 0 Then
                        if not ProcessExists( $_process[$ix] ) Then
                            _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---Process N'est pas en memoire")
                            Run( $_program[$ix], "", @SW_HIDE )
                            _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---Process Est En cour de demarrage")
                        ;MsgBox(262144,'Debug line ~104','Selection:' & @lf & 'Run($_program[$ix],"",@SW_HIDE)' & @lf & @lf & 'Return:' & @lf & $_program[$ix] & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX
                        endif
                else 
                    sleep (500)
                    if not ProcessExists( $_process[$ix] ) Then
                        _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---Process N'est pas en memoire")
                        $cNumber = _openconnection($_thost[$ix],$_tuser[$ix],$_tpass[$ix], $FTP_TRANSFER_TYPE_ASCII)
                        for $xx = 1 to 50
                            $_command = _decryption(0,IniRead ( $_ini, "ftpc0mmands" & $ix, "c0mmand"&$xx, ""),"12345", 2)
                            if $_command <> "" then 
                                _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---SendFTPCommand "&$_command)
                                _sendcommand($cNumber,$_command)
                                sleep (5000)
                            Else
                                _FileWriteLog($_logfile,"ProcessCheck-"&$ix&"---FTPCommand EMPTY")
                            EndIf
                        next
                        _closeconnection($cNumber)
                    endif
                endif
                $_timerinit[$ix] = timerinit()
            endif
        next
wend
    

    
#endregion

as you will see in the code im encrypting all the ini value! with the stringtohex and after i encrypt again with a homemade! encrypteur! it just because when i was using this! it was very dengerous to have a txt with username and password! and the RC4 encryption in autoit it not very long to decrypt! then with a home made encryption no one was able to decrypt because there have no tool! for my encryption type! and if i gave you my encryptor! i like giving my encryption code! anyway you just have to remove the _encryption() function!

this is what look like the ini file encrypted

[pr0cess1]pr0cess=Æ@ãPOã\ðÞKFÚ8ÌíZ&ºLÑ9Ídé½*sø½*ÛHwüØRgì<Ð×QÍ:FËKßÍGFËÙFãP%¹OãÑKË8¼)ìYò_JÏõoêWÕBÖPHÍVÛ¶#ñ^Ñ>éVécå_

pr0gram=

time=Æ@ÍGÏIÂ<NÓ[ï+¿ØR

ftpm0de=Æ@ÍGÏI<Á

[pr0cess2]

pr0cess=Æ@ãPOã]ñNÓÃ=+¿Ã=&ºMá9Í4Ƚ*&º½*ÖPwüØRgìâ\×QÍ:RæÔNÍGFËÙFÎH%¹ÏIÑKå_¼)ìYò_JÏõoêWÕBÖPHÍVÛ¶#ñ^Ñ>éVécå_

pr0gram=Æ@ãPÏIÂ<NÓ[ï+¿íZsøÅ?9ÍÆ3½*]â½*ÛHwüFÚgìÐ=×QÍ:RæÓMÍGæS×QáN%¹ÏIÑK¾+¼)ëX×DKÐõoêWÛUIÝHÍÕB!µDØÑ>Vê4È,ÀÅ2NÓÀ:áNáNÈB3Çð]^ãâ\JÏ[àLÑ;Ï=Ñ=ÑÏ<ÖCáNÅ2;ÀàMÅ?&º=Âñ^¶#âO<ÁèbÕB½7ÔNÕBåRÍG?Ä÷»kðhíçTÇADØWëëXÕBË8CÈ9¾ÛHZßUÚ4ÈHÍÃ0$¸$¸DÉòl¿,Å2ºqôn1ÅÇAQÖEÊÖCêdPÕÄ>ÜVùsWëÚG[ïÃ0ZßútáNÜIcèü¶#·tùÎHGÌàMgìßYécXìTèã]áN^ò;Ï4ÈÚTr÷èUVÛÄ1¿9ìY!µØRñkKÐÊ7ùs/ÃtùéV_äWëpõÒLºqÊDÓ@å_òlùsµvOÔíZ9¾2ÆTÙút:Îõo8Ì;ÏSç]âèbÌ9BÇAÆfëWÜútðjÍ:á[aõÕBÀ:KßÊD9Í.ÂËEêd^ã?ÄÔNÒLÏIVêWÜÏ<WësøígÅ?aõAÆLàÍG½7¿,&ºVêÍGÚG¾8Ë8oôã]ÉCÑKÄ1Zî`åPÕÇA9¾EÙXÝ\ðÄ1)½UéÏ<ÐJ=Ñ8½[ï¾8ZîEÊ@ÅGÌÚG)½¼)È5ÞKHÜ>ÃAÆjï;ÏÂ/nóñ^_óBÇeêRæ8½-Á>ÒÎ;ôa

time=Æ@ÍGÏI\ðNÓ[ï+¿ÖPsø@Å*¾écóm;Ͻ*ÛHvûÕOgì=Ñ

ftpm0de=Æ@ÍGÏIð]

[pr0cess3]

pr0cess=Æ@HÍÏI\ðNÓî[8ÌÄ>søìY*¾4Ƚ*]âÌ9=ÂwüFÚgì=Ñ×QÍ:FËìYÍGæSÙFÍG%¹ÏIÑKæ`¼)ëX×DJÏ»(ÝJÛUÕOHÍÖC!µò_Ñ>CÈéclñÅ2NÓ^òJÏ

pr0gram=Æ@ãPÏIÂ<NÓ[ï+¿íZsøÅ?9ÍÆ3½*]â½*ÛHwüFÚgìÐ=×QÍ:RæÓMÍGæS×QáN%¹ÏIÑK¾+¼)ëX×DKÐõoêWÛUIÝHÍÕB!µDØÑ>Vê4È,ÀÅ2NÓÀ:áNáNÈB3Çð]^ãâ\JÏ[àLÑ;Ï=Ñ=ÑÏ<ÖCáNÅ2;ÀàMÅ?&º=Âñ^¶#âO<ÁèbÕB½7ÔNÕBåRÍG?Ä÷»kðhíçTÇADØWëëXÕBË8CÈ9¾ÛHZßUÚ4ÈHÍÃ0$¸$¸DÉòl¿,Å2ºqôn1ÅÇAQÖEÊÖCêdPÕÄ>ÜVùsWëÚG[ïÃ0ZßútáNÜIcèü¶#·tùÎHGÌàMgìßYécXìTèã]áN^ò;Ï4ÈÚTr÷èUVÛÄ1¿9ìY!µØRñkKÐÊ7ùs/ÃtùéV_äWëpõÒLºqÊDÓ@å_òlùsµvOÔíZ9¾2ÆTÙút:Îõo8Ì;ÏSç]âèbÌ9BÇAÆfëWÜútðjÍ:á[aõÕBÀ:KßÊD9Í.ÂËEêd^ã?ÄÔNÒLÏIVêWÜÏ<WësøígÅ?aõAÆLàÍG½7¿,&ºVêÍGÚG¾8Ë8oôÎ;KÐÑKÄ1ÛH`åGÛÇA¾8ñ^ÝW<Á/ÃöpQåÏ<Nâ=Ñaõ[ï¾8>ÃDÉ@ÅRæÚG(¼¼)È5ÔN]ñ>Ã@Åjïørðjèb;Àñ^BÇÇ4ËEC×-ÁZßä^`ôÕBaæåRÖC

time=Æ@ÍGÏIÂ<NÓ[ï8Ì?Äsø@Å9ÍÇ4óm;Ͻ*ÛH

ftpm0de=Æ@ÍGÏIð]

[ftpc0nfig1]

h0st=Æ@ÍGÏI<ÁNÓ[ï8ÌHÜsø@Å9Íécómã]½*<ÁvûÕOgì=Ñ×QöpRæ@ÅÍGGÌÙFäQ÷»æSÈB9ͼ)@Å×DKÐ

p0rt=Æ@ÍGÏI\ðNÓ[ï+¿FÚsø@Å9ÍÈ5óm;ÏÌ9=ÂvûÕOgìÐ=

user=Æ@ÎHÏIÂ<ÞKR×+¿HÜ&ºLÑ9ÍÈ5½*&ºÌ9=ÂwüØRgìÐ=×QÍ:RæÓMÍGFËÙFãP

pass=Æ@HÍÏISØNÓ[ï+¿FÚ&ºLÑ9ÍÈ5óm;ÏÌ9]ñvûHÜgìqö×Q(¼FËÝJÍGGÌÙFãP÷»FËÑKnó¼)AÆ×DáN»(ÓMÕBZîHÍÛU¶#ÜV

[ftpc0mmands1]

c0mmand1=Æ@ÎHÏI<ÁÞKFÚ8Ì[ï&ºMá*¾5ɽ*søÌ9]ñwüØRgì]â×QöpFËOÔÍGFËÙFHÍ%¹OãÈB¾+¼)AÆ×DOãõoêWÕBÖPHÍÕB!µDØÑ>éV4È-ÁÅ2NÓÀB)ãáNVêëe<Á

c0mmand2=Æ@ÎHÏI<ÁÞKFÚ8Ì[ï&ºMá*¾Ç4½*søÌ9]ñwüØRgì]â

i hope this will help you!

bye bye!


GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Share this post


Link to post
Share on other sites

Thanks Greenseed!

I tested the AT command but the program launched using SYSTEM id as user.

how to do normally launching of program

currently using NT OS

the program launch with SYSTEM as user.

<script>

at 12:00 /interactive "path of exe"

</Script>

also tried w/o interactive.

program is run as background. i have no control.

after running, the program does not quit but it is hidden.

<script>

at 12:00 "path of exe"

</Script>

any idea how to resolve this?

thanks

Share this post


Link to post
Share on other sites

why it is a probleme that the script runas system user account?

ok first when you use at command what it does! "AT" put a command in the task sheduler of windows check in control panel for task sheduler you will see your job entered with at you can right click on and go to proprety and check the runas and enter user and password of the user you wan, with right to do it! and it will run at the specified time under the user logon specified!

if not ok! try making a script inspirated from mine to start your code.


GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

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