Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/dash.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ def local(port,path):
ClientIP = output[10:]
elif "127.0.0.1" in output:
out = str(output).split(' ')
with open('ip.bin', 'r') as file: # extracting the ip from the file
ip = file.read()
if out[6] == '/':
process_display(0,0,"Someone Opened the page")
process_display(0,0,"Someone at {} has opened your page.".format(ip))
elif out[-2] == '204':
process_display(0,0,"Upload Completed")
process_display(0,0,"File received from {}".format(ip))



Expand Down Expand Up @@ -110,5 +112,6 @@ def forward(port):
thread1.join()
thread2.join()
except:
os.remove('ip.bin') # deleting the file which contains the ip
print("\nYou're Great..!\nThanks for using :)")
sys.exit(0)
16 changes: 16 additions & 0 deletions src/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,27 @@

@app.route("/")
def index():
try:
ip = request.environ['HTTP_X_FORWARDED_FOR'] # if behind a proxy
except KeyError:
ip = request.environ['REMOTE_ADDR']

with open('ip.bin', 'w') as file: # saving the ip in the file
file.write(ip)

return render_template("index.html")


@app.route("/upload", methods=['POST'])
def upload():
try:
ip = request.environ['HTTP_X_FORWARDED_FOR'] # if behind a proxy
except KeyError:
ip = request.environ['REMOTE_ADDR']

with open('ip.bin', 'w') as file: # saving the ip in the file
file.write(ip)

target = os.path.join(args.path)
print(target)

Expand Down