bluerein Posted November 2, 2008 Share Posted November 2, 2008 Is there anyway to alter a compiled exe ....on the fly?? eg $szFile="my.exe" FileOpen($szFile, BitOR(16, 1)) $letters="" For $i = 1 To 2 $letters &= Chr(Random(48, 57, 1)) Next FileDelete($szFile) FileWrite($szFile,$letters ) so basically this code is in the exe ,when its started it writes some numbers at the end of the file Link to comment Share on other sites More sharing options...
trancexx Posted November 2, 2008 Share Posted November 2, 2008 Did you try it? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
bluerein Posted November 2, 2008 Author Share Posted November 2, 2008 ?? yeah that works on a file called my.exe not if the file im executing is called my.exe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 2, 2008 Moderators Share Posted November 2, 2008 ??yeah that works on a file called my.exe not if the file im executing is called my.exeYou can't write to an executable that is open. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 thought as much... ok then ...I created a loader first then ...so I run the loader it alters the main exe then it launches the exe... Why wont it work though?? $szFile="my.exe" FileOpen($szFile, BitOR(16, 1)) $letters="" For $i = 1 To 2 $letters &= Chr(Random(48, 57, 1)) Next FileDelete($szFile) FileWrite($szFile,$letters ) FileClose($szFile) sleep(1000) run("my.exe") exit it opens the exe writes to it then wont open it!! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 3, 2008 Moderators Share Posted November 3, 2008 You need to learn how to use FileOpen()/FileRead()/FileWrite() it seems... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 sorry you lost me there... Why whats wrong ?? Thats the bit that works..Its the last line that doesnt work.. Link to comment Share on other sites More sharing options...
Bert Posted November 3, 2008 Share Posted November 3, 2008 You could use command line switches to alter the way the exe would run. Example: if your loader says to run with this server and this ID and password, then the exe would do this: myapp.exe /server123 /ID_abc /PW_123 The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 Not sure what servers,id's and passwords have got to do with it... I'll explain a bit better... I have 2 exe's in a folder loader.exe and app.exe ... when i run loader.exe it: 1,writes to app.exe 2, runs app.exe 3,exits Link to comment Share on other sites More sharing options...
Developers Jos Posted November 3, 2008 Developers Share Posted November 3, 2008 Not sure what servers,id's and passwords have got to do with it...I'll explain a bit better...I have 2 exe's in a folder loader.exe and app.exe ...when i run loader.exe it:1,writes to app.exe 2, runs app.exe 3,exitsThe question is still not answered: Why do you need to write to the exe and not use another way of passing the variables?Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 The exe is just wrote to ,to change the crc32 thats all... Link to comment Share on other sites More sharing options...
Developers Jos Posted November 3, 2008 Developers Share Posted November 3, 2008 The exe is just wrote to ,to change the crc32 thats all... I hope this is not the answer to my question because else I do not understand it . SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bert Posted November 3, 2008 Share Posted November 3, 2008 (edited) I don't think you understand what I'm getting at. You would be passing information to the exe that you need for it to use. If you want to write to the EXE, then you would need to inject the code in. The only time you need to write to the exe is if you want to permanently change the exe if it was to be ran later by itself. (without any interaction from you or your loader. (Note, this is what a virus does, so you may want to think about this approach) Is that what you need to happen? If you are basically telling it what it needs to access something for example, then pass that to it via the switch. It is pretty basic and a simple way to solve your problem. Edited November 3, 2008 by Volly The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 Im really confused now!! The exe will be permanetly change ... it adds "XX" to the end of the file each time the loader runs... so I run the loader , it then writes "XX" to the end of app.exe , then lauches app.exe , then loader.exe closes Link to comment Share on other sites More sharing options...
Developers Jos Posted November 3, 2008 Developers Share Posted November 3, 2008 Im really confused now!!The exe will be permanetly change ... it adds "XX" to the end of the file each time the loader runs...so I run the loader , it then writes "XX" to the end of app.exe , then lauches app.exe , then loader.exe closesMaybe I missed it but could you try to explain what you want in stead of asking for a solution to the way you think it should work.Explain to us what you exactly want to accomplish and maybe we can help you. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 I'll repost my original code.. $szFile="my.exe" FileOpen($szFile, BitOR(16, 1)) $letters="" For $i = 1 To 2 $letters &= Chr(Random(48, 57, 1)) Next FileDelete($szFile) FileWrite($szFile,$letters ) FileClose($szFile) sleep(1000) run("my.exe") exit lets start at the beginning then.. The code above is what I'll refer to as loader.exe.. And another exe called app.exe which is the main prog(example a msgbox compiled as an exe) Now when loader.exe is ran it writes 2 numbers to the end of app.exe , once loader.exe has done this loader.exe launches the modified app.exe then loader.exe closes and the app.exe should now be running Hope this helps Link to comment Share on other sites More sharing options...
Developers Jos Posted November 3, 2008 Developers Share Posted November 3, 2008 (edited) Try to answer the questions asked, not to repeat what you already said. Why do you want to add something to the end of an EXE. What is the purpose? Edited November 3, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Bert Posted November 3, 2008 Share Posted November 3, 2008 Another way to ask - What do those 2 numbers do for the my.exe? Could you use a ini file to host the numbers and my.exe reference that? What we are trying to get at is there isn't a good reason to write to the exe when there are many easier ways to get information the exe needs. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted November 3, 2008 Share Posted November 3, 2008 Now when loader.exe is ran it writes 2 numbers to the end of app.exe , once loader.exe has done this loader.exe launches the modified app.exe then loader.exe closes and the app.exe should now be runningWhat does those 2 numbers do to the exe? Are you trying to change the file size of the exe? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
bluerein Posted November 3, 2008 Author Share Posted November 3, 2008 (edited) the sole purpose of writing to the exe is to change the crc32...thats all I found if you write to the end of a file it still runs... I think this is where were getting lost .. alls I want to do is change the files crc32 then launch it... Im passing no info about ..its straight forward openfile() filewrite() run() Edited November 3, 2008 by bluerein Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now