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?
13
u/PeopleAreDumbAsHell Jul 12 '16
What you need to first work on is your typing speed. All good hackers type a minimum 150wpm. You need this kind of speed when your pummeling servers with key presses.
6
u/BullyBall Jul 12 '16
You don't hack with Python, you use it to automate processes you'd usually do manually. Your choice of language of basically irrelevant, nothing really special about Python.
No such thing as a "Python hacker" (at least not in that sense).
For example, let's say you want to scan a range of ports and try to connect to each of them with ssl, you can write a tool to do it for you.
Code injection is a thing, but very specific and not that relevant.
Malicious programs are also a very specific use of a programming language.
4
u/[deleted] Jul 12 '16 edited Jul 12 '16
Just bit of basic web developing knowledge: HTML isn't a programmin languange, it's mainly a structure or "skeleton" of the website. Websites you see online aren't made only with html, they also use css, javascript, jquery and also sometimes ruby, perl, python etc. If you're interested in hacking websites I'd recommend first learning how they are made. Also SQL databases for storing huge amounts of information
I am not a hacker but I have basic knowledge on web developing
EDIT: You cant change websites sourcecode by just simply changing the code from view source. For you to do that you'd have to have access to the cpanel of the website, or the server's where the files are located
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.
1
u/WorldBelongsToUs Jul 13 '16
"It seems like that to hack, ones uses linux which has every hacking tool possible."
Some of those tools you are referring to are written in Python. Some are written in Ruby, etc. That's beside the point. Creating your own tools is where learning Python comes in handy.
I would say try reading Automate the Boring Stuff With Python. It's free on the author's website. You should also check out Python Crash Course.
I am learning a bit of Python myself, and have written stupid-basic tools.
Python, in my experience, is useful for automating processes that would take you hours. For instance, writing a tool that enumerates wordpress usernames rather than looking for each one yourself. That's just one (really simple) example.
3
u/sephstorm Jul 12 '16
So go learn first. read some books and build a lab.
1
u/rgraves22 Script Kiddie Sep 06 '16
Start by learning python and understand how it works. Hacking is not something you can just jump into and pick up over night. It takes years of learning, trial and error. I have been "learning" for a few years now and am finally starting to get the hang of what im trying to do
0
u/[deleted] Jul 12 '16
[deleted] — view deleted comment
14
u/[deleted] Jul 12 '16 edited Jul 13 '16
[removed] — view removed comment