This repo is used as documentation for my CAN Arsenal addition in NetHunter apk.
This module allow you to control your CAN Interface and diagnostic your car with can-utils and cannelloni tools. Device should have CAN, SLCAN, VCAN, CAN-RAW, CAN-GW, CAN-BCM enabled as module in the kernel, optionally enable USB_SERIAL_CH341 and CAN USB Interfaces Drivers too.
TODO
This button will open the following documentation in a Browser.
This button will run Setup to install needed CAN tools and packages. Note that it shouldn't be needed as it should be launched as first run.
This button will update the installed CAN tools and packages.
These settings are needed to be used as variable while running commands with the buttons interaction.
If these USB Modules drivers are enabled in your Kernel. You can use the dropdown to select the desired module, and press the button to load it (if unloaded) or to unload it (if loaded).
Note : Full path of modules should be specified in the Modules tab of the Nethunter App.
Here you can Start or Stop CAN, VCAN or SLCAN interface.
Command run to Start CAN :
Prerequisite : Set "CAN Interface" and "UART Speed" in Settings
modprobe -a can can-raw can-gw can-bcm
sudo ip link set <CAN Interface> type can bitrate <UART Speed>
sudo ip link set up <CAN Interface>
Command run to Stop CAN interface :
Prerequisite : Set "CAN Interface" in Settings
modprobe -r can-raw can-gw can-bcm can
sudo ip link set <CAN Interface> down
Command run to Start VCAN :
Prerequisite : Set "CAN Interface" and "MTU" in Settings
modprobe -a vcan can can-raw can-gw can-bcm
ip link add dev <CAN Interface> type vcan && ip link set <CAN Interface> mtu <MTU>
ip link set up <CAN Interface>
Command run to Stop VCAN interface :
Prerequisite : Set "CAN Interface" in Settings
modprobe -r can-raw can-gw can-bcm vcan can
sudo ip link set <CAN Interface> down
Command run to Start SLCAN :
Prerequisite : CAN USB Adapter plugged in and set "CAN Interface", "CAN Speed" and "UART Speed" in Settings Note : Flow Control is set to Software as default
modprobe -a can slcan can-raw can-gw can-bcm
sudo slcan_attach -f -s<CAN Speed> -o /dev/ttyUSB0
sudo slcand -o -s<CAN Speed> -t sw -S <UART Speed> /dev/ttyUSB0 <CAN Interface>
sudo ip link set up <CAN Interface>
Command run to Stop SLAN interface :
Prerequisite : CAN USB Adapter plugged in and set "CAN Interface" in Settings
sudo ip link set <CAN Interface> down
sudo slcan_attach -d /dev/ttyUSB0
modprobe -r can-raw can-gw can-bcm can slcan
Command to run CanGen to generate CAN traffic :
Prerequisite : Started your desired CAN interface and set "CAN Interface" in Settings
cangen <CAN Interface> -v
Command to run CanSniffer to sniff CAN traffic :
Prerequisite : Started your desired CAN interface and set "CAN Interface" in Settings
cansniffer <CAN Interface>
Command to run CanDump to dump CAN traffic to a file :
Prerequisite : Started your desired CAN interface and set "CAN Interface", "Output" path in Settings
candump <CAN Inteface> -f <Output Log>
Command to run CanSend to replay a specific sequence :
Prerequisite : Started your desired CAN interface and set "CAN Interface", "Sequence" in Settings
cansend <CAN Interface> <Sequence>
Command to run CanPlayer to replay dumped sequences in a log file :
Prerequisite : Started your desired CAN interface and set "CAN Interface", "Input" path in Settings
canplayer -I <Input Log>
You can see the source code here.
Command to run SequenceFinder to find the exact sequence of the desired action from a log file :
Note : This custom script will auto split a log files using head and tail, replay these in loop using CanPlayer until finding the exact sequence of the desired action and replay it with CanSend.
Prerequisite : Started your desired CAN interface and set "Input" path in Settings
/opt/car_hacking/sequence_finder.sh <Input Log>
Command to run Cannelloni to communicate with two machine on a CAN interface by Ethernet :
Prerequisite : Started your desired CAN interface in Settings and set "RHOST", "RPORT" and "LPORT" in Cannelloni.
sudo cannelloni -I <CAN Interface> -R <RHOST> -r <RPORT> -l <LPORT>
Command to run Asc2Log to convert ASC format file to classic log file :
Prerequisite : Set "Input" and "Output" path in Settings.
asc2log -I <Input Log> -O <Output File>
Command to run Log2Asc to convert dumped log in the ASC format :
Prerequisite : Set "Input", "Output" path and "CAN Interface" in Settings.
log2asc -I <Input Log> -O <Output File> <CAN Interface>
This is in case you need to run a specific command which doesnt match the one provided.