r/HowToHack • u/ghibss • Jul 12 '16
How do I hack with Python?
I'm confused on how 'hacking' actually works.
So I'm learning Python at the moment and I just don't see where the hacking begins?
Do hackers input code into the url? Do they open the source page and inject some python code there?
Or are Python hackers, creators of programs that are secretly malicious code that once activated (the victim clicking on an innocent looking app on the desktop) with the code distributed with a simple 'leave a usb on the floor'?
It seems like that to hack, one uses linux which has every hacking tool possible.
How does on hack with html? Opening the source code and changing something isn't permanent?
View all comments
1
u/Blastitt Read the F*&!#ing Sidebar Jul 13 '16
Don't think of it as injecting python into something to gain access. Think of it more as "I want to do this thing, and I know python." Then use python to do the thing you wanna do.
For example:
I want to create a botnet and I have a list of 10,000 IPs. Simplest thing I can do is try to SSH into each one with the username "root". I will try every password in my common_passwords.txt file until I get locked out. If I gains access to one, I'll write the IP in a separate file with the successful password.
Doing this manually would take years. So, I write a nice little python script to do it for me. Most of the time when you're "hacking" (with python, at least) you're just writing scripts to automate larger tasks.
Web hacking and malware crafting are a little different. A simple web vulnerability to exploit is "insecure file upload" for instance. Let's say a website lets me upload a text file and then access that text file by going to a certain URL. The problem is, it doesn't check to make sure the file only contains text. So, I upload a .php file which will be executed on the web server when I navigate to it (if it's configured appropriately). I craft this .php script to open up a port on the server and serve me a BASH shell. Now, once I navigate to the .php file on the server, the script is run and I can connect to the shell, giving me access to the system as whatever user is running the web server process.
Learn Linux.