Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Add files via upload

Abdul Wahab Junaidb5e7beb69562
diff --git a/Python Tools/Ftp Server/checkFTPanonymousLogin.py b/Python Tools/Ftp Server/checkFTPanonymousLogin.py
new file mode 100644
index 0000000..5a7193a
--- /dev/null
+++ b/Python Tools/Ftp Server/checkFTPanonymousLogin.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+
+import ftplib
+
+def anonymousLogin(hostname):
+ try:
+ ftp = ftplib.FTP(hostname)
+ response = ftp.login('anonymous', 'anonymous')
+ print(response)
+ if "230 Anonymous access granted" in response:
+ print('\n[*] ' + str(hostname) +' FTP Anonymous Login Succeeded.')
+ print(ftp.getwelcome())
+ ftp.dir()
+ except Exception as e:
+ print(str(e))
+ print('\n[-] ' + str(hostname) +' FTP Anonymous Login Failed.')
+
+hostname = 'ftp.be.debian.org'
+anonymousLogin(hostname)
diff --git a/Python Tools/Ftp Server/ftp_download_file.py b/Python Tools/Ftp Server/ftp_download_file.py
new file mode 100644
index 0000000..c55618d
--- /dev/null
+++ b/Python Tools/Ftp Server/ftp_download_file.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import ftplib
+
+FTP_SERVER_URL = 'ftp.be.debian.org'
+DOWNLOAD_DIR_PATH = '/pub/linux/kernel/v5.x/'
+DOWNLOAD_FILE_NAME = 'ChangeLog-5.0'
+
+def ftp_file_download(server, username):
+ ftp_client = ftplib.FTP(server, username)
+ ftp_client.cwd(DOWNLOAD_DIR_PATH)
+ try:
+ with open(DOWNLOAD_FILE_NAME, 'wb') as file_handler:
+ ftp_cmd = 'RETR %s' %DOWNLOAD_FILE_NAME
+ ftp_client.retrbinary(ftp_cmd,file_handler.write)
+ ftp_client.quit()
+ except Exception as exception:
+ print('File could not be downloaded:',exception)
+
+if __name__ == '__main__':
+ ftp_file_download(server=FTP_SERVER_URL,username='anonymous')
diff --git a/Python Tools/Ftp Server/ftp_download_file_bytes.py b/Python Tools/Ftp Server/ftp_download_file_bytes.py
new file mode 100644
index 0000000..5d6fcee
--- /dev/null
+++ b/Python Tools/Ftp Server/ftp_download_file_bytes.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+from ftplib import FTP
+
+ftp_client=FTP('ftp.be.debian.org')
+ftp_client.login()
+ftp_client.cwd('/pub/linux/kernel/v5.x/')
+ftp_client.voidcmd("TYPE I")
+datasock,estsize=ftp_client.ntransfercmd("RETR ChangeLog-5.0")
+transbytes=0
+with open('ChangeLog-5.0','wb') as file_descryptor:
+ while True:
+ buffer=datasock.recv(2048)
+ if not len(buffer):
+ break
+ file_descryptor.write(buffer)
+ transbytes +=len(buffer)
+ print("Bytes received",transbytes,"Total",(estsize,100.0*float(transbytes)/float(estsize)),str('%'))
+datasock.close()
+ftp_client.quit()
diff --git a/Python Tools/Ftp Server/ftp_list_server_anonymous.py b/Python Tools/Ftp Server/ftp_list_server_anonymous.py
new file mode 100644
index 0000000..e193ebd
--- /dev/null
+++ b/Python Tools/Ftp Server/ftp_list_server_anonymous.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+import ftplib
+
+FTP_SERVER_URL = 'ftp.be.debian.org'
+DOWNLOAD_DIR_PATH = '/pub/linux/kernel/v5.x/'
+
+def check_anonymous_connection(host, path):
+ with ftplib.FTP(host, user="anonymous") as connection:
+ print( "Welcome to ftp server ", connection.getwelcome())
+ for name, details in connection.mlsd(path):
+ print( name, details['type'], details.get('size') )
+
+if __name__ == '__main__':
+ check_anonymous_connection(FTP_SERVER_URL,DOWNLOAD_DIR_PATH)
diff --git a/Python Tools/Ftp Server/get_ftp_file.py b/Python Tools/Ftp Server/get_ftp_file.py
new file mode 100644
index 0000000..e9e8805
--- /dev/null
+++ b/Python Tools/Ftp Server/get_ftp_file.py
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+
+from ftplib import FTP
+
+def writeData(data):
+ file_descryptor.write(data+"\n")
+
+ftp_client=FTP('ftp.be.debian.org')
+ftp_client.login()
+ftp_client.cwd('/pub/linux/kernel/v5.x/')
+
+file_descryptor=open('ChangeLog-5.0','wt')
+ftp_client.retrlines('RETR ChangeLog-5.0',writeData)
+file_descryptor.close()
+ftp_client.quit()
+