This repository contains various Python scripts demonstrating different functionalities, ranging from basic file operations to object-oriented programming (OOP), threading, and hacking simulations. Below is an overview of each script:
Basic operations in Python including:
- Reading from a file in Linux.
- Writing to a file in Linux.
- Executing Linux commands using Python.
A simple project for scanning a domain using nmap
:
- Asks the user for a domain name.
- Executes an
nmap
scan on the entered domain using theos.system()
function.
Generates RSA keys using the rsa
module:
- Creates a public and private key pair.
- Prints the keys to the console.
Encryption using RSA public key:
- Generates a pair of public and private keys.
- Encrypts a test message using the public key.
- Prints the encrypted message.
A simple example of sending an HTTP GET request:
- Sends a GET request to a test website.
- Displays the response content and status code.
An example of sending an HTTP POST request:
- Sends a POST request with a payload containing username and password.
- Prints the response content and status code.
Basic Object-Oriented Programming concepts:
- Demonstrates list iteration and searching.
- Multiple function definitions with overloading.
- Basic OOP class examples including methods and object instantiation.
Continuation of OOP concepts:
- Class definition and method calling.
- Using
__init__()
constructor. - Demonstrates method chaining and object behavior.
More OOP examples:
- Class constructors with and without parameters.
- Demonstrates default parameter values.
Inheritance in Object-Oriented Programming:
- Demonstrates parent and child class relationships.
- Usage of
super()
to call parent class methods and constructors.
- Example 1: Creates and starts two threads that print "Hello World" concurrently.
- Example 2: Creates a thread to print "Hello World" five times, using
.join()
to wait for completion. - Example 3: Prints the current time five times using a thread, ensuring order with
.join()
. - Example 4: Creates 10 threads to print numbers from 0 to 9, demonstrating concurrent execution.
- Example 5: Asks the user for their name and prints a greeting using a thread.
- Python 3.x
- Required modules:
rsa
for RSA key generation and encryption.requests
for HTTP requests.
Install requirements using:
pip install rsa requests
To run any of the scripts:
python3 script_name.py
Example:
python3 01.PythonBasic.py
- Some scripts require Linux commands or tools (e.g.,
nmap
). - Make sure you have the necessary permissions to run network scans.
- These scripts are for educational purposes only. Use responsibly.