1

I have converted a python script to .exe file. I just want to run the exe file from a VB script. Now the problem is that the python script accepts arguments during run-time (e.g.: serial port number, baud rate, etc.) and I cannot do the same with the .exe file. Can someone help me how to proceed?

Morix Dev
  • 2,700
  • 1
  • 28
  • 49

2 Answers2

1

If you don't have the source to the python exe convertor and if the arguments don't need to change on each execution, you could probably open the exe in a debugger like ollydbg and search for shellexecute or createprocess and then create a string in a code cave and use that for the arguments. I think that's your only option.

Another idea: Maybe make your own extractor that includes the python script, vbscript, and python interpreter. You could just use a 7zip SFX or something.

Synaps3
  • 1,597
  • 2
  • 15
  • 23
1

If you have the source code of the Python script, you could change the source code and get command line arguments passed to the script from sys.argv, like this:

import sys
print(sys.argv)

Also, the argparse module may help you if the command line interface of your script is complex.

Documentation of sys module

Possibly Related Question

Community
  • 1
  • 1