a
This commit is contained in:
17
WS24_25/PyCharm/pythonProject/A/a.py
Normal file
17
WS24_25/PyCharm/pythonProject/A/a.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
# Open the image
|
||||||
|
image = Image.open('alles_mit_flag.bmp')
|
||||||
|
|
||||||
|
# Split the image into Red, Green, and Blue channels
|
||||||
|
red, green, blue = image.split()
|
||||||
|
|
||||||
|
# Save each channel as a separate grayscale image
|
||||||
|
red.save('red_channel.bmp')
|
||||||
|
green.save('green_channel.bmp')
|
||||||
|
blue.save('blue_channel.bmp')
|
||||||
|
|
||||||
|
# Optionally, show the images
|
||||||
|
red.show()
|
||||||
|
green.show()
|
||||||
|
blue.show()
|
||||||
46
WS24_25/PyCharm/pythonProject/A/bruteForce.py
Normal file
46
WS24_25/PyCharm/pythonProject/A/bruteForce.py
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import requests
|
||||||
|
from fake_useragent import UserAgent
|
||||||
|
|
||||||
|
# URL to brute force
|
||||||
|
url = "https://ctfd.labs.inf.fh-dortmund.de/ctfd-challenge-4"
|
||||||
|
|
||||||
|
# Create a UserAgent instance
|
||||||
|
ua = UserAgent()
|
||||||
|
|
||||||
|
# Default HTML content
|
||||||
|
default_response = """<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>User Agent Info</title>
|
||||||
|
<link rel="stylesheet" href="/ctfd-challenge-4/static/style.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<h1>IBM Workstation Server</h1>
|
||||||
|
<p>Diese Seite bedient ausschließlich von IBM eingerichtete Geräte</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>"""
|
||||||
|
|
||||||
|
# Function to brute force headers
|
||||||
|
def brute_force_user_agent():
|
||||||
|
for _ in range(500000): # Adjust the range for the number of User-Agents you want to try
|
||||||
|
user_agent = ua.random # Generate a random User-Agent
|
||||||
|
headers = {
|
||||||
|
"User-Agent": user_agent
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
response = requests.get(url, headers=headers)
|
||||||
|
if response.text.strip() != default_response.strip():
|
||||||
|
print(f"User-Agent '{user_agent}' gives a different response:")
|
||||||
|
print(response.text)
|
||||||
|
return
|
||||||
|
# else:
|
||||||
|
# print(f"Nope: '{user_agent}'")
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
print(f"Error with User-Agent '{user_agent}': {e}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
brute_force_user_agent()
|
||||||
9
WS24_25/PyCharm/pythonProject/P3/api.py
Normal file
9
WS24_25/PyCharm/pythonProject/P3/api.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import pandas as pd
|
||||||
|
api_url = "https://overfast-api.tekrop.fr/heroes"
|
||||||
|
response = requests.get(api_url)
|
||||||
|
json_data = response.json()
|
||||||
|
with open('heroes.json', 'w') as outfile: json.dump(json_data, outfile)
|
||||||
|
df = pd.read_json(json.dumps(json_data))
|
||||||
|
csv_data = df.to_csv('csv_data.csv')
|
||||||
0
WS24_25/PyCharm/pythonProject/P3/getData.py
Normal file
0
WS24_25/PyCharm/pythonProject/P3/getData.py
Normal file
0
WS24_25/PyCharm/pythonProject/P3/numbers.py
Normal file
0
WS24_25/PyCharm/pythonProject/P3/numbers.py
Normal file
Reference in New Issue
Block a user