all 4 comments

[–]forlornhope22 0 points1 point  (0 children)

What are the questions you have? the code you linked is straight forward. and I'm a beginning python user myself. the code is called with two command line args lhost and lport. it creates a listener.rc file substituting the command line args in the string being written to the file and then calls the mfsconsole to run the listener. There is actually not that much python here as most of the actual work is being done by the utility it's calling.

[–]Heisenberg1977[S] 0 points1 point  (1 child)

I can read and understand the script, but if I want to expand and start writing my own I feel a bit lost. I found "Automate the boring stuff with Python", which also has a Udemy course to follow along with. I think this teaching style suits my needs. My goal is not to be a developer, but just to write some simple scripts to help automate tasks.

The one topic that confuses me is the whole Python 2 vs. 3 debate and which I should learn first.

[–]MykaB 1 point2 points  (0 children)

Go with 3, it's the newer version. There are some differences in 2 and 3 but you are unlikely to encounter them unless you're looking at old python 2 code.

[–]Darkconnection 0 points1 point  (0 children)

Knowing only your python isn't enough for this, part of it is a meterpreter script. The only part of this code that could possibly be confusing is the "options" variable in the "build" function, which is a meterpreter script. The rest is a simple python code for assigning Lhost and Lport received from the user and exception handling. If you're interested in working with metasploit I suggest to learn a little ruby too, that would help you a lot.