misc python code
This commit is contained in:
14
code/misc/python/scripts/MITM/.gitignore
vendored
Normal file
14
code/misc/python/scripts/MITM/.gitignore
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
*.pyc
|
||||
*.db
|
||||
*.python-version
|
||||
/.quarto/
|
||||
.ipynb_checkpoints
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
719
code/misc/python/scripts/MITM/Terms-to-Block.csv
Normal file
719
code/misc/python/scripts/MITM/Terms-to-Block.csv
Normal file
@@ -0,0 +1,719 @@
|
||||
anal
|
||||
analprobe
|
||||
anilingus
|
||||
anus
|
||||
areola
|
||||
areole
|
||||
arian
|
||||
aryan
|
||||
ass
|
||||
assbang
|
||||
assbanged
|
||||
assbangs
|
||||
asses
|
||||
assfuck
|
||||
assfucker
|
||||
assh0le
|
||||
asshat
|
||||
assho1e
|
||||
ass hole
|
||||
assholes
|
||||
assmaster
|
||||
assmunch
|
||||
asswipe
|
||||
asswipes
|
||||
azazel
|
||||
azz
|
||||
b1tch
|
||||
babe
|
||||
babes
|
||||
ballsack
|
||||
bang
|
||||
banger
|
||||
barf
|
||||
bastard
|
||||
bastards
|
||||
bawdy
|
||||
beaner
|
||||
beardedclam
|
||||
beastiality
|
||||
beatch
|
||||
beater
|
||||
beaver
|
||||
beer
|
||||
beeyotch
|
||||
beotch
|
||||
biatch
|
||||
bigtits
|
||||
big tits
|
||||
bimbo
|
||||
bitch
|
||||
bitched
|
||||
bitches
|
||||
bitchy
|
||||
blow job
|
||||
blow
|
||||
blowjob
|
||||
blowjobs
|
||||
bod
|
||||
bodily
|
||||
boink
|
||||
bollock
|
||||
bollocks
|
||||
bollok
|
||||
bone
|
||||
boned
|
||||
boner
|
||||
boners
|
||||
bong
|
||||
boob
|
||||
boobies
|
||||
boobs
|
||||
booby
|
||||
booger
|
||||
bookie
|
||||
bootee
|
||||
bootie
|
||||
booty
|
||||
booze
|
||||
boozer
|
||||
boozy
|
||||
bosom
|
||||
bosomy
|
||||
bowel
|
||||
bowels
|
||||
bra
|
||||
brassiere
|
||||
breast
|
||||
breasts
|
||||
bugger
|
||||
bukkake
|
||||
bullshit
|
||||
bull shit
|
||||
bullshits
|
||||
bullshitted
|
||||
bullturds
|
||||
bung
|
||||
busty
|
||||
butt
|
||||
butt fuck
|
||||
buttfuck
|
||||
buttfucker
|
||||
buttfucker
|
||||
buttplug
|
||||
c.0.c.k
|
||||
c.o.c.k.
|
||||
c.u.n.t
|
||||
c0ck
|
||||
c-0-c-k
|
||||
caca
|
||||
cahone
|
||||
cameltoe
|
||||
carpetmuncher
|
||||
cawk
|
||||
cervix
|
||||
chinc
|
||||
chincs
|
||||
chink
|
||||
chink
|
||||
chode
|
||||
chodes
|
||||
cl1t
|
||||
climax
|
||||
clit
|
||||
clitoris
|
||||
clitorus
|
||||
clits
|
||||
clitty
|
||||
cocain
|
||||
cocaine
|
||||
cock
|
||||
c-o-c-k
|
||||
cockblock
|
||||
cockholster
|
||||
cockknocker
|
||||
cocks
|
||||
cocksmoker
|
||||
cocksucker
|
||||
cock sucker
|
||||
coital
|
||||
commie
|
||||
condom
|
||||
coon
|
||||
coons
|
||||
corksucker
|
||||
crabs
|
||||
crack
|
||||
cracker
|
||||
crackwhore
|
||||
crap
|
||||
crappy
|
||||
cum
|
||||
cummin
|
||||
cumming
|
||||
cumshot
|
||||
cumshots
|
||||
cumslut
|
||||
cumstain
|
||||
cunilingus
|
||||
cunnilingus
|
||||
cunny
|
||||
cunt
|
||||
cunt
|
||||
c-u-n-t
|
||||
cuntface
|
||||
cunthunter
|
||||
cuntlick
|
||||
cuntlicker
|
||||
cunts
|
||||
d0ng
|
||||
d0uch3
|
||||
d0uche
|
||||
d1ck
|
||||
d1ld0
|
||||
d1ldo
|
||||
dago
|
||||
dagos
|
||||
dammit
|
||||
damn
|
||||
damned
|
||||
damnit
|
||||
dawgie-style
|
||||
dick
|
||||
dickbag
|
||||
dickdipper
|
||||
dickface
|
||||
dickflipper
|
||||
dickhead
|
||||
dickheads
|
||||
dickish
|
||||
dick-ish
|
||||
dickripper
|
||||
dicksipper
|
||||
dickweed
|
||||
dickwhipper
|
||||
dickzipper
|
||||
diddle
|
||||
dike
|
||||
dildo
|
||||
dildos
|
||||
diligaf
|
||||
dillweed
|
||||
dimwit
|
||||
dingle
|
||||
dipship
|
||||
doggie-style
|
||||
doggy-style
|
||||
dong
|
||||
doofus
|
||||
doosh
|
||||
dopey
|
||||
douch3
|
||||
douche
|
||||
douchebag
|
||||
douchebags
|
||||
douchey
|
||||
drunk
|
||||
dumass
|
||||
dumbass
|
||||
dumbasses
|
||||
dummy
|
||||
dyke
|
||||
dykes
|
||||
ejaculate
|
||||
enlargement
|
||||
erect
|
||||
erection
|
||||
erotic
|
||||
essohbee
|
||||
extacy
|
||||
extasy
|
||||
f.u.c.k
|
||||
fack
|
||||
fag
|
||||
fagg
|
||||
fagged
|
||||
faggit
|
||||
faggot
|
||||
fagot
|
||||
fags
|
||||
faig
|
||||
faigt
|
||||
fannybandit
|
||||
fart
|
||||
fartknocker
|
||||
fat
|
||||
felch
|
||||
felcher
|
||||
felching
|
||||
fellate
|
||||
fellatio
|
||||
feltch
|
||||
feltcher
|
||||
fisted
|
||||
fisting
|
||||
fisty
|
||||
floozy
|
||||
foad
|
||||
fondle
|
||||
foobar
|
||||
foreskin
|
||||
freex
|
||||
frigg
|
||||
frigga
|
||||
fubar
|
||||
fuck
|
||||
f-u-c-k
|
||||
fuckass
|
||||
fucked
|
||||
fucked
|
||||
fucker
|
||||
fuckface
|
||||
fuckin
|
||||
fucking
|
||||
fucknugget
|
||||
fucknut
|
||||
fuckoff
|
||||
fucks
|
||||
fucktard
|
||||
fuck-tard
|
||||
fuckup
|
||||
fuckwad
|
||||
fuckwit
|
||||
fudgepacker
|
||||
fuk
|
||||
fvck
|
||||
fxck
|
||||
gae
|
||||
gai
|
||||
ganja
|
||||
gay
|
||||
gays
|
||||
gey
|
||||
gfy
|
||||
ghay
|
||||
ghey
|
||||
gigolo
|
||||
glans
|
||||
goatse
|
||||
godamn
|
||||
godamnit
|
||||
goddam
|
||||
goddammit
|
||||
goddamn
|
||||
goldenshower
|
||||
gonad
|
||||
gonads
|
||||
gook
|
||||
gooks
|
||||
gringo
|
||||
gspot
|
||||
g-spot
|
||||
gtfo
|
||||
guido
|
||||
h0m0
|
||||
h0mo
|
||||
handjob
|
||||
hard on
|
||||
he11
|
||||
hebe
|
||||
heeb
|
||||
hell
|
||||
hemp
|
||||
heroin
|
||||
herp
|
||||
herpes
|
||||
herpy
|
||||
hitler
|
||||
hiv
|
||||
hobag
|
||||
hom0
|
||||
homey
|
||||
homo
|
||||
homoey
|
||||
honky
|
||||
hooch
|
||||
hookah
|
||||
hooker
|
||||
hoor
|
||||
hootch
|
||||
hooter
|
||||
hooters
|
||||
horny
|
||||
hump
|
||||
humped
|
||||
humping
|
||||
hussy
|
||||
hymen
|
||||
inbred
|
||||
incest
|
||||
injun
|
||||
j3rk0ff
|
||||
jackass
|
||||
jackhole
|
||||
jackoff
|
||||
jap
|
||||
japs
|
||||
jerk
|
||||
jerk0ff
|
||||
jerked
|
||||
jerkoff
|
||||
jism
|
||||
jiz
|
||||
jizm
|
||||
jizz
|
||||
jizzed
|
||||
junkie
|
||||
junky
|
||||
kike
|
||||
kikes
|
||||
kill
|
||||
kinky
|
||||
kkk
|
||||
klan
|
||||
knobend
|
||||
kooch
|
||||
kooches
|
||||
kootch
|
||||
kraut
|
||||
kyke
|
||||
labia
|
||||
lech
|
||||
leper
|
||||
lesbians
|
||||
lesbo
|
||||
lesbos
|
||||
lez
|
||||
lezbian
|
||||
lezbians
|
||||
lezbo
|
||||
lezbos
|
||||
lezzie
|
||||
lezzies
|
||||
lezzy
|
||||
lmao
|
||||
lmfao
|
||||
loin
|
||||
loins
|
||||
lube
|
||||
lusty
|
||||
mams
|
||||
massa
|
||||
masterbate
|
||||
masterbating
|
||||
masterbation
|
||||
masturbate
|
||||
masturbating
|
||||
masturbation
|
||||
maxi
|
||||
menses
|
||||
menstruate
|
||||
menstruation
|
||||
meth
|
||||
m-fucking
|
||||
mofo
|
||||
molest
|
||||
moolie
|
||||
moron
|
||||
motherfucka
|
||||
motherfucker
|
||||
motherfucking
|
||||
mtherfucker
|
||||
mthrfucker
|
||||
mthrfucking
|
||||
muff
|
||||
muffdiver
|
||||
murder
|
||||
muthafuckaz
|
||||
muthafucker
|
||||
mutherfucker
|
||||
mutherfucking
|
||||
muthrfucking
|
||||
nad
|
||||
nads
|
||||
naked
|
||||
napalm
|
||||
nappy
|
||||
nazi
|
||||
nazism
|
||||
negro
|
||||
nigga
|
||||
niggah
|
||||
niggas
|
||||
niggaz
|
||||
nigger
|
||||
nigger
|
||||
niggers
|
||||
niggle
|
||||
niglet
|
||||
nimrod
|
||||
ninny
|
||||
nipple
|
||||
nooky
|
||||
nympho
|
||||
opiate
|
||||
opium
|
||||
oral
|
||||
orally
|
||||
organ
|
||||
orgasm
|
||||
orgasmic
|
||||
orgies
|
||||
orgy
|
||||
ovary
|
||||
ovum
|
||||
ovums
|
||||
p.u.s.s.y.
|
||||
paddy
|
||||
paki
|
||||
pantie
|
||||
panties
|
||||
panty
|
||||
pastie
|
||||
pasty
|
||||
pcp
|
||||
pecker
|
||||
pedo
|
||||
pedophile
|
||||
pedophilia
|
||||
pedophiliac
|
||||
pee
|
||||
peepee
|
||||
penetrate
|
||||
penetration
|
||||
penial
|
||||
penile
|
||||
penis
|
||||
perversion
|
||||
peyote
|
||||
phalli
|
||||
phallic
|
||||
phuck
|
||||
pillowbiter
|
||||
pimp
|
||||
pinko
|
||||
piss
|
||||
pissed
|
||||
pissoff
|
||||
piss-off
|
||||
pms
|
||||
polack
|
||||
pollock
|
||||
poon
|
||||
poontang
|
||||
porn
|
||||
porno
|
||||
pornography
|
||||
pot
|
||||
potty
|
||||
prick
|
||||
prig
|
||||
prostitute
|
||||
prude
|
||||
pube
|
||||
pubic
|
||||
pubis
|
||||
punkass
|
||||
punky
|
||||
puss
|
||||
pussies
|
||||
pussy
|
||||
pussypounder
|
||||
puto
|
||||
queaf
|
||||
queef
|
||||
queef
|
||||
queer
|
||||
queero
|
||||
queers
|
||||
quicky
|
||||
quim
|
||||
racy
|
||||
rape
|
||||
raped
|
||||
raper
|
||||
rapist
|
||||
raunch
|
||||
rectal
|
||||
rectum
|
||||
rectus
|
||||
reefer
|
||||
reetard
|
||||
reich
|
||||
retard
|
||||
retarded
|
||||
revue
|
||||
rimjob
|
||||
ritard
|
||||
rtard
|
||||
r-tard
|
||||
rum
|
||||
rump
|
||||
rumprammer
|
||||
ruski
|
||||
s.h.i.t.
|
||||
s.o.b.
|
||||
s0b
|
||||
sadism
|
||||
sadist
|
||||
scag
|
||||
scantily
|
||||
schizo
|
||||
schlong
|
||||
screw
|
||||
screwed
|
||||
scrog
|
||||
scrot
|
||||
scrote
|
||||
scrotum
|
||||
scrud
|
||||
scum
|
||||
seaman
|
||||
seamen
|
||||
seduce
|
||||
semen
|
||||
sex
|
||||
sexual
|
||||
sh1t
|
||||
s-h-1-t
|
||||
shamedame
|
||||
shit
|
||||
s-h-i-t
|
||||
shite
|
||||
shiteater
|
||||
shitface
|
||||
shithead
|
||||
shithole
|
||||
shithouse
|
||||
shits
|
||||
shitt
|
||||
shitted
|
||||
shitter
|
||||
shitty
|
||||
shiz
|
||||
sissy
|
||||
skag
|
||||
skank
|
||||
slave
|
||||
sleaze
|
||||
sleazy
|
||||
slut
|
||||
slutdumper
|
||||
slutkiss
|
||||
sluts
|
||||
smegma
|
||||
smut
|
||||
smutty
|
||||
snatch
|
||||
sniper
|
||||
snuff
|
||||
s-o-b
|
||||
sodom
|
||||
souse
|
||||
soused
|
||||
sperm
|
||||
spic
|
||||
spick
|
||||
spik
|
||||
spiks
|
||||
spooge
|
||||
spunk
|
||||
steamy
|
||||
stfu
|
||||
stiffy
|
||||
stoned
|
||||
strip
|
||||
stroke
|
||||
stupid
|
||||
suck
|
||||
sucked
|
||||
sucking
|
||||
sumofabiatch
|
||||
t1t
|
||||
tampon
|
||||
tard
|
||||
tawdry
|
||||
teabagging
|
||||
teat
|
||||
terd
|
||||
teste
|
||||
testee
|
||||
testes
|
||||
testicle
|
||||
testis
|
||||
thrust
|
||||
thug
|
||||
tinkle
|
||||
tit
|
||||
titfuck
|
||||
titi
|
||||
tits
|
||||
tittiefucker
|
||||
titties
|
||||
titty
|
||||
tittyfuck
|
||||
tittyfucker
|
||||
toke
|
||||
toots
|
||||
tramp
|
||||
transsexual
|
||||
trashy
|
||||
tubgirl
|
||||
turd
|
||||
tush
|
||||
twat
|
||||
twats
|
||||
ugly
|
||||
undies
|
||||
unwed
|
||||
urinal
|
||||
urine
|
||||
uterus
|
||||
uzi
|
||||
vag
|
||||
vagina
|
||||
valium
|
||||
viagra
|
||||
virgin
|
||||
vixen
|
||||
vodka
|
||||
vomit
|
||||
voyeur
|
||||
vulgar
|
||||
vulva
|
||||
wad
|
||||
wang
|
||||
wank
|
||||
wanker
|
||||
wazoo
|
||||
wedgie
|
||||
weed
|
||||
weenie
|
||||
weewee
|
||||
weiner
|
||||
weirdo
|
||||
wench
|
||||
wetback
|
||||
wh0re
|
||||
wh0reface
|
||||
whitey
|
||||
whiz
|
||||
whoralicious
|
||||
whore
|
||||
whorealicious
|
||||
whored
|
||||
whoreface
|
||||
whorehopper
|
||||
whorehouse
|
||||
whores
|
||||
whoring
|
||||
wigger
|
||||
womb
|
||||
woody
|
||||
wop
|
||||
wtf
|
||||
x-rated
|
||||
xxx
|
||||
yeasty
|
||||
yobbo
|
||||
zoophile
|
||||
|
113
code/misc/python/scripts/MITM/app.py
Normal file
113
code/misc/python/scripts/MITM/app.py
Normal file
@@ -0,0 +1,113 @@
|
||||
from flask import Flask, render_template, redirect, url_for, request, flash
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
import getpass,datetime
|
||||
|
||||
app = Flask(__name__)
|
||||
app.secret_key = 'your_secret_key'
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
|
||||
db = SQLAlchemy(app)
|
||||
login_manager = LoginManager()
|
||||
login_manager.init_app(app)
|
||||
login_manager.login_view = 'login'
|
||||
|
||||
class User(UserMixin, db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
username = db.Column(db.String(150), unique=True, nullable=False)
|
||||
password_hash = db.Column(db.String(150), nullable=False)
|
||||
must_change_password = db.Column(db.Boolean, default=True, nullable=False)
|
||||
|
||||
def __init__(self, username, password, must_change_password=True):
|
||||
self.username = username
|
||||
self.password_hash = generate_password_hash(password)
|
||||
self.must_change_password = must_change_password
|
||||
|
||||
def check_password(self, password):
|
||||
return check_password_hash(self.password_hash, password)
|
||||
|
||||
class UserRequest(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
url = db.Column(db.String(500), nullable=False)
|
||||
reason = db.Column(db.String(500), nullable=False)
|
||||
status = db.Column(db.String(50), nullable=False, default='pending')
|
||||
user = db.Column(db.String(150), nullable=False)
|
||||
mac_address = db.Column(db.String(50), nullable=False)
|
||||
ip_address = db.Column(db.String(50), nullable=False)
|
||||
timestamp = db.Column(db.DateTime, nullable=False)
|
||||
|
||||
@login_manager.user_loader
|
||||
def load_user(user_id):
|
||||
return User.query.get(int(user_id))
|
||||
|
||||
@app.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
username = request.form['username']
|
||||
password = request.form['password']
|
||||
user = User.query.filter_by(username=username).first()
|
||||
if user and user.check_password(password):
|
||||
login_user(user)
|
||||
if user.must_change_password:
|
||||
return redirect(url_for('change_password'))
|
||||
return redirect(url_for('admin'))
|
||||
else:
|
||||
flash('Invalid username or password')
|
||||
return render_template('login.html')
|
||||
|
||||
@app.route('/logout')
|
||||
@login_required
|
||||
def logout():
|
||||
logout_user()
|
||||
return redirect(url_for('login'))
|
||||
|
||||
@app.route('/change_password', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def change_password():
|
||||
if request.method == 'POST':
|
||||
new_password = request.form['new_password']
|
||||
current_user.password_hash = generate_password_hash(new_password)
|
||||
current_user.must_change_password = False
|
||||
db.session.commit()
|
||||
flash('Password changed successfully')
|
||||
return redirect(url_for('admin'))
|
||||
return render_template('change_password.html')
|
||||
|
||||
@app.route('/admin')
|
||||
@login_required
|
||||
def admin():
|
||||
requests = UserRequest.query.all()
|
||||
return render_template('admin.html', requests=requests)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@app.route('/whitelist', methods=['POST'])
|
||||
def whitelist():
|
||||
url = request.form['url']
|
||||
reason = request.form['reason']
|
||||
user = current_user.username if current_user.is_authenticated else 'anonymous'
|
||||
mac_address = '00:00:00:00:00:00' # Placeholder, replace with actual MAC address retrieval logic
|
||||
ip_address = request.remote_addr # Gets the IP address of the client
|
||||
timestamp = datetime.utcnow()
|
||||
new_request = UserRequest(url=url, reason=reason, user=user, mac_address=mac_address, ip_address=ip_address, timestamp=timestamp)
|
||||
db.session.add(new_request)
|
||||
db.session.commit()
|
||||
return redirect(url_for('index'))
|
||||
|
||||
def create_admin_user():
|
||||
admin_user = User.query.filter_by(username='admin').first()
|
||||
if not admin_user:
|
||||
print("No admin user found. Please set a password for the admin user.")
|
||||
password = getpass.getpass("Enter password for admin user: ")
|
||||
admin_user = User(username='admin', password=password)
|
||||
db.session.add(admin_user)
|
||||
db.session.commit()
|
||||
print("Admin user created successfully.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
create_admin_user()
|
||||
app.run(debug=True)
|
||||
133
code/misc/python/scripts/MITM/appv1.py
Normal file
133
code/misc/python/scripts/MITM/appv1.py
Normal file
@@ -0,0 +1,133 @@
|
||||
from flask import Flask, request, render_template, redirect, url_for, session
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from werkzeug.security import generate_password_hash, check_password_hash
|
||||
from datetime import datetime, timedelta
|
||||
from scapy.all import ARP, Ether, srp
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///whitelist.db'
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||
app.secret_key = 'supersecretkey'
|
||||
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=5)
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
class Whitelist(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
url = db.Column(db.String(255), unique=True, nullable=False)
|
||||
|
||||
class Request(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
url = db.Column(db.String(255), nullable=False)
|
||||
reason = db.Column(db.String(255), nullable=False)
|
||||
status = db.Column(db.String(50), nullable=False, default='pending')
|
||||
timestamp = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
|
||||
mac_address = db.Column(db.String(17), nullable=False)
|
||||
ip_address = db.Column(db.String(45), nullable=False)
|
||||
|
||||
class Admin(db.Model):
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
password = db.Column(db.String(255), nullable=False)
|
||||
|
||||
|
||||
|
||||
def get_mac_address(ip_address):
|
||||
try:
|
||||
# Create an ARP request packet
|
||||
arp_request = ARP(pdst=ip_address)
|
||||
# Create an Ethernet frame to encapsulate the ARP request
|
||||
ether = Ether(dst="ff:ff:ff:ff:ff:ff")
|
||||
# Combine the Ethernet frame and ARP request
|
||||
packet = ether / arp_request
|
||||
# Send the packet and capture the response
|
||||
result = srp(packet, timeout=3, verbose=False)[0]
|
||||
# Extract the MAC address from the response
|
||||
mac_address = result[0][1].hwsrc
|
||||
return mac_address
|
||||
except Exception as e:
|
||||
print(f"Error getting MAC address: {e}")
|
||||
return "00:00:00:00:00:00"
|
||||
|
||||
@app.route('/set_admin_password', methods=['GET', 'POST'])
|
||||
def set_admin_password():
|
||||
if Admin.query.first():
|
||||
return redirect(url_for('admin_login'))
|
||||
if request.method == 'POST':
|
||||
password = request.form['password']
|
||||
hashed_password = generate_password_hash(password)
|
||||
new_admin = Admin(password=hashed_password)
|
||||
db.session.add(new_admin)
|
||||
db.session.commit()
|
||||
return redirect(url_for('admin_login'))
|
||||
return render_template('set_admin_password.html')
|
||||
|
||||
@app.route('/admin_login', methods=['GET', 'POST'])
|
||||
def admin_login():
|
||||
if request.method == 'POST':
|
||||
password = request.form['password']
|
||||
admin = Admin.query.first()
|
||||
if admin and check_password_hash(admin.password, password):
|
||||
session['admin_logged_in'] = True
|
||||
session.permanent = True # Mark the session as permanent
|
||||
return redirect(url_for('admin'))
|
||||
else:
|
||||
return "Invalid password"
|
||||
return render_template('admin_login.html')
|
||||
|
||||
@app.route('/admin_logout')
|
||||
def admin_logout():
|
||||
session.pop('admin_logged_in', None)
|
||||
return redirect(url_for('admin_login'))
|
||||
|
||||
@app.route('/admin', methods=['GET', 'POST'])
|
||||
def admin():
|
||||
if not session.get('admin_logged_in'):
|
||||
return redirect(url_for('admin_login'))
|
||||
if request.method == 'POST':
|
||||
action = request.form['action']
|
||||
url = request.form['url']
|
||||
req = Request.query.filter_by(url=url).first()
|
||||
if req:
|
||||
if action == 'approve':
|
||||
req.status = 'approved'
|
||||
if not Whitelist.query.filter_by(url=url).first():
|
||||
new_whitelist = Whitelist(url=url)
|
||||
db.session.add(new_whitelist)
|
||||
elif action == 'reject':
|
||||
req.status = 'rejected'
|
||||
whitelist_entry = Whitelist.query.filter_by(url=url).first()
|
||||
if whitelist_entry:
|
||||
db.session.delete(whitelist_entry)
|
||||
elif action == 'revoke':
|
||||
req.status = 'revoked'
|
||||
whitelist_entry = Whitelist.query.filter_by(url=url).first()
|
||||
if whitelist_entry:
|
||||
db.session.delete(whitelist_entry)
|
||||
db.session.commit()
|
||||
return redirect(url_for('admin'))
|
||||
requests = Request.query.all()
|
||||
whitelist = Whitelist.query.all()
|
||||
return render_template('admin.html', requests=requests, whitelist=whitelist)
|
||||
|
||||
@app.route('/whitelist', methods=['GET'])
|
||||
def get_whitelist():
|
||||
whitelist = Whitelist.query.all()
|
||||
return {"whitelist": [entry.url for entry in whitelist]}
|
||||
|
||||
@app.route('/', methods=['GET', 'POST'])
|
||||
def request_whitelist():
|
||||
if request.method == 'POST':
|
||||
url = request.form['url']
|
||||
reason = request.form['reason']
|
||||
ip_address = request.remote_addr
|
||||
mac_address = get_mac_address(ip_address)
|
||||
new_request = Request(url=url, reason=reason, mac_address=mac_address, ip_address=ip_address)
|
||||
db.session.add(new_request)
|
||||
db.session.commit()
|
||||
return redirect(url_for('request_whitelist'))
|
||||
return render_template('request.html')
|
||||
|
||||
if __name__ == '__main__':
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
app.run(debug=True)
|
||||
209
code/misc/python/scripts/MITM/driver.py
Normal file
209
code/misc/python/scripts/MITM/driver.py
Normal file
@@ -0,0 +1,209 @@
|
||||
import asyncio
|
||||
import sys
|
||||
import re
|
||||
import zlib
|
||||
import json
|
||||
import csv
|
||||
import requests
|
||||
from mitmproxy import http, ctx
|
||||
from mitmproxy import options
|
||||
from mitmproxy.tools import dump
|
||||
import sqlite3
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
# Method 1: Load blocked words from a CSV file
|
||||
def load_blocked_words_from_csv(file_path):
|
||||
"""
|
||||
Loads blocked words from a CSV file.
|
||||
|
||||
Args:
|
||||
file_path (str): The path to the CSV file containing blocked words.
|
||||
|
||||
Returns:
|
||||
list: A list of blocked words loaded from the CSV file.
|
||||
"""
|
||||
blocked_words = []
|
||||
with open(file_path, newline='') as csvfile:
|
||||
reader = csv.reader(csvfile)
|
||||
for row in reader:
|
||||
blocked_words.extend(row)
|
||||
return blocked_words
|
||||
|
||||
# Method 2: Load blocked words from a web service
|
||||
def load_blocked_words_from_web_service(url):
|
||||
"""
|
||||
Fetches blocked words from a web service.
|
||||
|
||||
Args:
|
||||
url (str): The URL of the web service to fetch blocked words from.
|
||||
|
||||
Returns:
|
||||
list: A list of blocked words.
|
||||
"""
|
||||
try:
|
||||
response = requests.get(url)
|
||||
response.raise_for_status() # Raise an error for bad status codes
|
||||
blocked_words = response.json() # Assuming the response is a JSON array of words
|
||||
return blocked_words
|
||||
except requests.RequestException as e:
|
||||
ctx.log.error(f"Error fetching blocked words: {e}")
|
||||
return []
|
||||
|
||||
# Load blocked words from the web service
|
||||
blocked_words = ['fdhfghrth']#load_blocked_words_from_csv('Terms-to-Block.csv')
|
||||
#blocked_words = load_blocked_words_from_web_service('https://example.com/api/blocked_words')
|
||||
|
||||
# Compile a regex pattern for blocked words
|
||||
pattern = re.compile(r'\b(?:' + '|'.join(re.escape(word) for word in blocked_words) + r')\b', re.IGNORECASE)
|
||||
|
||||
def check_string_in_list(target_string, string_list):
|
||||
"""
|
||||
Checks if any string in a list is present in the target string.
|
||||
|
||||
Args:
|
||||
target_string (str): The string to search within.
|
||||
string_list (list): The list of strings to search for.
|
||||
|
||||
Returns:
|
||||
bool: True if any string in the list is found in the target string, False otherwise.
|
||||
"""
|
||||
return any(item in target_string for item in string_list)
|
||||
|
||||
def search_blocked_words_in_json(data, pattern):
|
||||
"""
|
||||
Recursively searches for blocked words in a JSON object.
|
||||
|
||||
Args:
|
||||
data (dict or list or str): The JSON data to search within.
|
||||
pattern (re.Pattern): The compiled regex pattern for blocked words.
|
||||
|
||||
Returns:
|
||||
list: A list of matches found in the JSON data.
|
||||
"""
|
||||
matches = []
|
||||
if isinstance(data, dict):
|
||||
for key, value in data.items():
|
||||
matches.extend(search_blocked_words_in_json(value, pattern))
|
||||
elif isinstance(data, list):
|
||||
for item in data:
|
||||
matches.extend(search_blocked_words_in_json(item, pattern))
|
||||
elif isinstance(data, str):
|
||||
matches.extend(pattern.findall(data))
|
||||
return matches
|
||||
|
||||
class RequestLogger:
|
||||
"""
|
||||
A class to log and filter HTTP requests and responses.
|
||||
"""
|
||||
def __init__(self):
|
||||
"""
|
||||
Initializes the RequestLogger and loads the whitelist.
|
||||
"""
|
||||
self.whitelist = []
|
||||
asyncio.create_task(self.load_whitelist_periodically())
|
||||
|
||||
async def load_whitelist(self):
|
||||
"""
|
||||
Loads the whitelist from the SQLite database.
|
||||
|
||||
Returns:
|
||||
list: A list of whitelisted URLs.
|
||||
"""
|
||||
conn = sqlite3.connect('whitelist.db')
|
||||
c = conn.cursor()
|
||||
c.execute("SELECT url FROM whitelist WHERE status='approved'")
|
||||
self.whitelist = [row[0] for row in c.fetchall()]
|
||||
conn.close()
|
||||
|
||||
async def load_whitelist_periodically(self):
|
||||
"""
|
||||
Periodically loads the whitelist every 20 seconds.
|
||||
"""
|
||||
while True:
|
||||
await self.load_whitelist()
|
||||
await asyncio.sleep(20)
|
||||
|
||||
def request(self, flow: http.HTTPFlow):
|
||||
"""
|
||||
Handles HTTP requests. Blocks requests to non-whitelisted URLs.
|
||||
|
||||
Args:
|
||||
flow (http.HTTPFlow): The HTTP flow object.
|
||||
"""
|
||||
if flow.request.pretty_host not in self.whitelist:
|
||||
ctx.log.info('Blocked request to %s' % flow.request.host)
|
||||
flow.response = http.Response.make(
|
||||
403, # Forbidden status code
|
||||
b"Blocked by URL whitelist", # Response content
|
||||
{"Content-Type": "text/plain"} # Response headers
|
||||
)
|
||||
return
|
||||
|
||||
def response(self, flow: http.HTTPFlow):
|
||||
"""
|
||||
Handles HTTP responses. Searches for blocked words in the response content.
|
||||
|
||||
Args:
|
||||
flow (http.HTTPFlow): The HTTP flow object.
|
||||
"""
|
||||
content_type = flow.response.headers.get("Content-Type", "")
|
||||
content = flow.response.content
|
||||
|
||||
# Handle compressed content
|
||||
if "gzip" in flow.response.headers.get("Content-Encoding", ""):
|
||||
content = zlib.decompress(content, zlib.MAX_WBITS | 16)
|
||||
|
||||
if "deflate" in flow.response.headers.get("Content-Encoding", ""):
|
||||
content = zlib.decompress(content)
|
||||
|
||||
# Decode content to text
|
||||
if isinstance(content, bytes):
|
||||
content = content.decode('utf-8', errors='ignore')
|
||||
|
||||
# Check if content is HTML
|
||||
if "text/html" in content_type:
|
||||
soup = BeautifulSoup(content, 'html.parser')
|
||||
text = soup.get_text()
|
||||
matches = pattern.findall(text)
|
||||
elif "application/json" in content_type:
|
||||
data = json.loads(content)
|
||||
matches = search_blocked_words_in_json(data, pattern)
|
||||
else:
|
||||
matches = []
|
||||
|
||||
# Search for matches in the text content
|
||||
if matches:
|
||||
matched_keyword = matches[0]
|
||||
flow.response.text = 'response contains filtered contents'
|
||||
ctx.log.error(matched_keyword)
|
||||
|
||||
flow.response = http.Response.make(
|
||||
200, # (optional) status code
|
||||
b"Hello World", # (optional) content
|
||||
{"Content-Type": "text/html"}, # (optional) headers
|
||||
)
|
||||
|
||||
async def start_proxy(host, port):
|
||||
"""
|
||||
Starts the proxy server.
|
||||
|
||||
Args:
|
||||
host (str): The host address to listen on.
|
||||
port (int): The port to listen on.
|
||||
"""
|
||||
opts = options.Options(listen_host=host, listen_port=port)
|
||||
|
||||
master = dump.DumpMaster(
|
||||
opts,
|
||||
with_termlog=False,
|
||||
with_dumper=False,
|
||||
)
|
||||
master.addons.add(RequestLogger())
|
||||
|
||||
await master.run()
|
||||
return master
|
||||
|
||||
if __name__ == '__main__':
|
||||
host = sys.argv[1]
|
||||
port = int(sys.argv[2])
|
||||
asyncio.run(start_proxy(host, port))
|
||||
9
code/misc/python/scripts/MITM/myaddon.py
Normal file
9
code/misc/python/scripts/MITM/myaddon.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import mitmproxy.http
|
||||
|
||||
class MyAddon:
|
||||
def request(self, flow: mitmproxy.http.HTTPFlow) -> None:
|
||||
print(flow.request.url)
|
||||
|
||||
addons = [
|
||||
MyAddon()
|
||||
]
|
||||
67
code/misc/python/scripts/MITM/templates/admin.html
Normal file
67
code/misc/python/scripts/MITM/templates/admin.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Admin Dashboard</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="mt-5">Admin Dashboard</h1>
|
||||
<a href="{{ url_for('admin_logout') }}" class="btn btn-danger float-right">Logout</a>
|
||||
<h2 class="mt-4">Pending Requests</h2>
|
||||
<table class="table table-bordered mt-3">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>URL/Domain</th>
|
||||
<th>Reason</th>
|
||||
<th>Status</th>
|
||||
<th>Date & Time</th>
|
||||
<th>IP Address</th>
|
||||
<th>MAC Address</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for req in requests %}
|
||||
<tr>
|
||||
<td>{{ req.url }}</td>
|
||||
<td>{{ req.reason }}</td>
|
||||
<td>{{ req.status }}</td>
|
||||
<td>{{ req.timestamp }}</td>
|
||||
<td>{{ req.ip_address }}</td>
|
||||
<td>{{ req.mac_address }}</td>
|
||||
<td>
|
||||
<form method="post" class="d-inline">
|
||||
<input type="hidden" name="url" value="{{ req.url }}">
|
||||
<input type="hidden" name="action" value="approve">
|
||||
<button type="submit" class="btn btn-success btn-sm">Approve</button>
|
||||
</form>
|
||||
<form method="post" class="d-inline">
|
||||
<input type="hidden" name="url" value="{{ req.url }}">
|
||||
<input type="hidden" name="action" value="reject">
|
||||
<button type="submit" class="btn btn-danger btn-sm">Reject</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<h2 class="mt-4">Whitelisted URLs/Domains</h2>
|
||||
<ul class="list-group mt-3">
|
||||
{% for url in whitelist %}
|
||||
<li class="list-group-item">
|
||||
{{ url.url }}
|
||||
<form method="post" class="d-inline float-right">
|
||||
<input type="hidden" name="url" value="{{ url.url }}">
|
||||
<input type="hidden" name="action" value="revoke">
|
||||
<button type="submit" class="btn btn-warning btn-sm">Revoke</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
22
code/misc/python/scripts/MITM/templates/admin_login.html
Normal file
22
code/misc/python/scripts/MITM/templates/admin_login.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Admin Login</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="mt-5">Admin Login</h1>
|
||||
<form method="post" class="mt-3">
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
15
code/misc/python/scripts/MITM/templates/change_password.html
Normal file
15
code/misc/python/scripts/MITM/templates/change_password.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Change Password</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Change Password</h1>
|
||||
<form method="POST">
|
||||
<label for="new_password">New Password:</label>
|
||||
<input type="password" name="new_password" id="new_password" required>
|
||||
<br>
|
||||
<button type="submit">Change Password</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
23
code/misc/python/scripts/MITM/templates/index.html
Normal file
23
code/misc/python/scripts/MITM/templates/index.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Whitelist Request</title>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<h1 class="mb-4">Request to Whitelist a URL</h1>
|
||||
<form action="/whitelist" method="post">
|
||||
<div class="form-group">
|
||||
<label for="url">URL:</label>
|
||||
<input type="text" class="form-control" id="url" name="url" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reason">Reason:</label>
|
||||
<textarea class="form-control" id="reason" name="reason" rows="3" required></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
27
code/misc/python/scripts/MITM/templates/login.html
Normal file
27
code/misc/python/scripts/MITM/templates/login.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Login</h1>
|
||||
<form method="POST">
|
||||
<label for="username">Username:</label>
|
||||
<input type="text" name="username" id="username" required>
|
||||
<br>
|
||||
<label for="password">Password:</label>
|
||||
<input type="password" name="password" id="password" required>
|
||||
<br>
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<ul>
|
||||
{% for message in messages %}
|
||||
<li>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</body>
|
||||
</html>
|
||||
26
code/misc/python/scripts/MITM/templates/request.html
Normal file
26
code/misc/python/scripts/MITM/templates/request.html
Normal file
@@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Request Whitelist</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="mt-5">Request URL/Domain Whitelisting</h1>
|
||||
<form method="post" class="mt-3">
|
||||
<div class="form-group">
|
||||
<label for="url">URL/Domain</label>
|
||||
<input type="text" class="form-control" id="url" name="url" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="reason">Reason</label>
|
||||
<input type="text" class="form-control" id="reason" name="reason" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Set Admin Password</title>
|
||||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="mt-5">Set Admin Password</h1>
|
||||
<form method="post" class="mt-3">
|
||||
<div class="form-group">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" class="form-control" id="password" name="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Set Password</button>
|
||||
</form>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
27
code/misc/python/scripts/MITM/templates/whitelist.html
Normal file
27
code/misc/python/scripts/MITM/templates/whitelist.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Whitelisted URLs</title>
|
||||
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container mt-5">
|
||||
<h1 class="mb-4">Whitelisted URLs</h1>
|
||||
<a href="{{ url_for('admin') }}" class="btn btn-secondary mb-4">Back to Admin</a>
|
||||
<table class="table table-bordered">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for url in approved_urls %}
|
||||
<tr>
|
||||
<td>{{ url[0] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
73
code/misc/python/scripts/MITM/testwflow.ipynb
Normal file
73
code/misc/python/scripts/MITM/testwflow.ipynb
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Error logged during startup, exiting...\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"ename": "SystemExit",
|
||||
"evalue": "1",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"An exception has occurred, use %tb to see the full traceback.\n",
|
||||
"\u001b[0;31mSystemExit\u001b[0m\u001b[0;31m:\u001b[0m 1\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/ys/.pyenv/versions/3.12.0/envs/mitm/lib/python3.12/site-packages/IPython/core/interactiveshell.py:3585: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.\n",
|
||||
" warn(\"To exit: use 'exit', 'quit', or Ctrl-D.\", stacklevel=1)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"import driver\n",
|
||||
"import asyncio\n",
|
||||
"import nest_asyncio\n",
|
||||
"\n",
|
||||
"# Apply nest_asyncio to allow nested event loops\n",
|
||||
"#nest_asyncio.apply()\n",
|
||||
"\n",
|
||||
"await driver.start_proxy('127.0.0.1', 8083)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "mitm",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.12.0"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
Reference in New Issue
Block a user