KickAss101

Writeups/Walkthroughs for n00bs by a n00b :)

Source Code
20 March 2022

Baisc Python For Hecking

A quick guide for the people who know basic python but don’t know how to implement it in infosec context.

Data Types Categories Types
Text types str
Numeric Types int, float, complex
Sequence Types list(mutable)[0,1], tuple(immutable)(0,1), range
Mapping Type dict {"key":"value"}
Set Types set, frozenset {0,1,2,3}
Boolean Type bool True False
Binary Types bytes, bytearray, memoryview

Data type of any object can be obtained by using the type() function


Handling Web Requests

Packages

Functions Description
requests.get() Returns requests.Response() object

Snippet

import requests
res = requests.get("https://www.google.com/")
content = res.content
print(content)

Sockets

import socket

Command line Arguments

import argparse

# Initialize the parser
parser = argparse.ArgumentParser()

# Add optional parameters
parser.add_argument("-t","--target", help="provide target", type="str",default="google.com")

# Parse arguments
args = parser.parse_args()

print(args.target)

Example

# python3 args.py -t yahoo.com
# python3 args.py --target yahoo.com

Oops

def main():
	print("test")

if __name__ == __main__:
	main()

< post under construction />

come back later »

tags: python - hacking