mirror of
https://github.com/The-Art-of-Hacking/h4cker.git
synced 2025-08-18 19:08:19 -04:00
adding python, ruby, and bash references
This commit is contained in:
parent
cb4a9a9206
commit
82d096e313
4 changed files with 1 additions and 1 deletions
5
python_ruby_and_bash/additional_resources.md
Normal file
5
python_ruby_and_bash/additional_resources.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# :octocat: Additional Resources and Lists
|
||||
- [Additional hacking resources for beginners](https://github.com/Amanchouhan192/Awesome-Hacking)
|
||||
- [Awesome Python](https://github.com/vinta/awesome-python)
|
||||
- [Awesome Bash](https://github.com/awesome-lists/awesome-bash)
|
||||
- [Awesome Shell](https://github.com/alebcay/awesome-shell)
|
14
python_ruby_and_bash/amazing_python_references.md
Normal file
14
python_ruby_and_bash/amazing_python_references.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Python-related References
|
||||
|
||||
One of the most comprehensive lists of Python-related resources is:
|
||||
https://github.com/vinta/awesome-python
|
||||
|
||||
## PySec
|
||||
* https://github.com/ebranca/owasp-pysec
|
||||
A hardened version of python created by the folks from OWASP. It makes it easier for security professionals and developers to write applications more resilient to attacks and manipulations.
|
||||
|
||||
## Anaconda
|
||||
* https://www.anaconda.com/download/
|
||||
Anaconda is a free and open source distribution of the Python and R programming languages for data science and machine learning related applications.
|
||||
|
||||
|
32
python_ruby_and_bash/python_nmap.py
Normal file
32
python_ruby_and_bash/python_nmap.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python
|
||||
# Author: Omar Santos @santosomar
|
||||
# version 1.0
|
||||
# This is a quick demonstration on how to use the python nmap library
|
||||
# * Pre-requisite: nmap python library.
|
||||
# * Install it with pip install python-nmap
|
||||
#####################################################################
|
||||
|
||||
import sys
|
||||
try:
|
||||
import nmap
|
||||
except:
|
||||
sys.exit("[!] It looks like the nmap library is not installed in your system. You can install it with: pip install python-nmap")
|
||||
|
||||
# The arguments to be processed
|
||||
if len(sys.argv) != 3:
|
||||
sys.exit("Please provide two arguments the first being the targets the second the ports")
|
||||
addr = str(sys.argv[1])
|
||||
port = str(sys.argv[2])
|
||||
|
||||
# the scanner part
|
||||
|
||||
my_scanner = nmap.PortScanner()
|
||||
my_scanner.scan(addr, port)
|
||||
for host in my_scanner.all_hosts():
|
||||
if not my_scanner[host].hostname():
|
||||
print("Not able to find the hostname for IP address %s") % (host)
|
||||
else:
|
||||
print("The hostname for IP address %s is %s") % (host, my_scanner[host].hostname())
|
||||
|
||||
#this prints the results of the scan in a csv file.
|
||||
print(my_scanner.csv())
|
62
python_ruby_and_bash/quick_scanner.py
Normal file
62
python_ruby_and_bash/quick_scanner.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/python
|
||||
# Author: Omar Santos @santosomar
|
||||
# version 1.0
|
||||
# This is a quick demonstration on how to create a
|
||||
# basic TCP port scanner using python.
|
||||
#####################################################################
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import socket, subprocess, sys
|
||||
|
||||
try:
|
||||
raw_input # Python 2
|
||||
except NameError:
|
||||
raw_input = input # Python 3
|
||||
|
||||
subprocess.call('clear', shell=True)
|
||||
|
||||
print('''\t
|
||||
___ __ __ _ ___ _ ___
|
||||
/ _ \| \/ | /_\ | _ ( ) __|
|
||||
| (_) | |\/| |/ _ \| //\__ \
|
||||
\___/|_| _|_/_/_\_\_|_\ |___/
|
||||
| | |_ _|_ _|_ _| | | __|
|
||||
| |__ | | | | | | | |__| _|
|
||||
|____|___| |_| _|_| |____|___|__
|
||||
/ __|/ __| /_\ | \| | \| | __| _ \\
|
||||
\__ \ (__ / _ \| .` | .` | _|| /
|
||||
|___/\___/_/ \_\_|\_|_|\_|___|_|_\\
|
||||
|
||||
''')
|
||||
|
||||
target_ip = raw_input("\t Please enter the IP address of the target host:").strip()
|
||||
port_1 = int(raw_input("\t Enter the first port to scan:\t").strip())
|
||||
port_2 = int(raw_input("\t Enter the last port to scan:\t").strip())
|
||||
print("~"*50)
|
||||
print("\n ...scanning target now. ", target_ip)
|
||||
print("~"*50)
|
||||
|
||||
try:
|
||||
for port in range(port_1, port_2):
|
||||
sock= socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
socket.setdefaulttimeout(1)
|
||||
|
||||
result = sock.connect_ex((target_ip, port))
|
||||
if result==0:
|
||||
print("Found open port:\t", port)
|
||||
sock.close()
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("[!] Scan stopped by user... ")
|
||||
sys.exit()
|
||||
|
||||
except socket.gaierror:
|
||||
print("[!] The target's hostname could not be resolved...")
|
||||
sys.exit()
|
||||
|
||||
except socket.error:
|
||||
print("[!] Target is unreachable...")
|
||||
sys.exit()
|
||||
|
||||
print("The scan is complete. Happy hacking!")
|
Loading…
Add table
Add a link
Reference in a new issue