I am now starting in python, and I'm following this book "Violent Python -> A cookbook for Hackers, Penetration Testers and Forensic Analyst". I think the book quite interesting and want to learn more about penetrations test and probably make me an expert in security informatics, I think this book is definitely a "must read".
I already have some knowledge of programming but I'm encountering a problem here, in the first exercise book in which the author teaches you program a basic "port scanner". I installed Filezilla to see if it worked and works perfect without functions, but when I start to create functions, such as the low it just runs without error but does not give me the welcome banner server mensage. Basically runs but does not show anything on the console. (By now I'm using Eclipse as IDE)
I'm a bit embarrassed because already search everything on google but not could find a reply to my problem, I think the problem might be in "if __ name__ == __ main__: main ()" but do not even know if it is.
The code is equal to the book. I hope you can help me thanks!
- Code: Select all
def ban (ip, port):
con.connect ((ip, port))
ban1= ban(ip1, port)
print("++"+ ip1 +":"+ str(ban1))
if __name__ == "__main__":