-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinux_operations.py
More file actions
132 lines (110 loc) · 2.83 KB
/
linux_operations.py
File metadata and controls
132 lines (110 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from os import system as sys
from termcolor import colored
import getpass
import smtplib
print(colored("""Enter 1 : to login as root user
Enter 2 : to see date & time
Enter 3 : to open calculator
Enter 4 : to create new user
Enter 5 : to install new software or tool
Enter 6 : to open new terminal
Enter 7 : to open text-editor
Enter 8 : to update whole system
Enter 9 : to scan website using nmap
Enter 10 : to check ip address
Enter 11 : to ping
Enter 12 : to configure web server
Enter 13 : to create banners
Enter 14 : to run any command
Enter 15 : to launch browser
Enter 16 : to search location of installed software/tool
Enter 17 : to open website
Enter 18 : to send an email
Enter 19 : to exit from linux operations
""","white"))
while True:
choice = int(input("Enter the no of your choice:"))
if(choice == 1):
sys("sudo su")
print()
elif choice == 2:
sys("date")
print()
elif choice == 3:
sys("bc")
print()
elif choice == 4:
print("Enter user name : ",end="")
create_user = input()
sys("useradd {}".format(create_user))
print()
elif choice == 5:
print("Enter software name : ",end="")
software_name=input()
sys("sudo yum install {}".format(software_name))
print()
elif choice == 6:
sys("gnome-terminal")
print()
elif choice == 7:
sys("vim new.txt") #open a new txt file in sublime text editor
print()
elif choice == 8:
sys("sudo yum update")
print()
elif choice == 9:
print("Enter Website or IP : ",end="")
website = input()
sys("nmap {}".format(website))
print()
elif choice == 10:
sys("ifconfig")
print()
elif choice == 11:
print("Enter Website or IP : ",end="")
website = input()
sys("ping {}".format(website))
print()
elif choice == 12:
sys("sudo apt-get install apache2")
print()
elif choice == 13:
print("enter banner name : ",end="")
banner_name = input()
sys("figlet {}".format(banner_name))
print()
elif choice == 14:
print("enter command : ",end="")
new_cmd = input()
sys("{}".format(new_cmd))
print()
elif choice == 15:
sys("firefox")
print()
elif choice == 16:
print("Enter name : ",end="")
s_file = input()
sys("which {}".format(s_file))
print()
elif choice == 17:
print("Enter website name : ",end="")
website = input()
sys("firefox {}".format(website))
print()
elif choice == 18:
sender_email = input(str("Enter your email :"))
rec_email = input(str("Enter receiver_email :"))
message = input("Enter your message : ")
password = getpass.getpass("Enter Your Password : ")
server = smtplib.SMTP('smtp.gmail.com',587)
server.ehlo()
server.starttls()
server.login(sender_email,password)
print("LogIn Successfull")
server.sendmail(sender_email,rec_email,message)
print("Your Email has been sent to : ",rec_email)
elif choice == 19:
sys("exit")
break
else:
print(colored("Invalid Choice","red"))