diff --git a/make.sh b/make.sh index 670d6e2..af6d329 100755 --- a/make.sh +++ b/make.sh @@ -1,2 +1,3 @@ -cross rustc --target armv7-unknown-linux-gnueabihf -- -C target-feature=+crt-static -adb push target/armv7-unknown-linux-gnueabihf/debug/diag /tmp/diag +cargo build +adb push target/armv7-unknown-linux-gnueabihf/debug/wavehunter /data/wavehunter/wavehunter +adb push target/armv7-unknown-linux-gnueabihf/debug/wavehunter-reader /data/wavehunter/wavehunter-reader diff --git a/scripts/misc-daemon b/scripts/misc-daemon new file mode 100644 index 0000000..4181f5a --- /dev/null +++ b/scripts/misc-daemon @@ -0,0 +1,102 @@ +#!/bin/sh + +set -e + +case "$1" in + start) + echo -n "Starting miscellaneous daemons: " + search_dir="/sys/bus/msm_subsys/devices/" + for entry in `ls $search_dir` + do + subsys_temp=`cat $search_dir/$entry/name` + if [ "$subsys_temp" == "modem" ] + then + break + fi + done + counter=0 + while [ ${counter} -le 10 ] + do + msstate=`cat $search_dir/$entry/state` + if [ "$msstate" == "ONLINE" ] + then + break + fi + counter=$(( $counter + 1 )) + sleep 1 + done + + if [ -f /etc/init.d/init_qcom_audio ] + then + /etc/init.d/init_qcom_audio start + fi + + if [ -f /sbin/reboot-daemon ] + then + /sbin/reboot-daemon & + fi + + if [ -f /etc/init.d/start_atfwd_daemon ] + then + /etc/init.d/start_atfwd_daemon start + fi + + if [ -f /etc/init.d/wavehunter_daemon ] + then + /etc/init.d/wavehunter_daemon start + fi + + if [ -f /etc/init.d/start_stop_qti_ppp_le ] + then + /etc/init.d/start_stop_qti_ppp_le start + fi + + if [ -f /etc/init.d/start_loc_launcher ] + then + /etc/init.d/start_loc_launcher start + fi + + echo -n "Completed starting miscellaneous daemons" + ;; + stop) + echo -n "Stopping miscellaneous daemons: " + + + if [ -f /etc/init.d/start_atfwd_daemon ] + then + /etc/init.d/start_atfwd_daemon stop + fi + + if [ -f /etc/init.d/start_loc_launcher ] + then + /etc/init.d/start_loc_launcher stop + fi + + if [ -f /etc/init.d/wavehunter_daemon ] + then + /etc/init.d/wavehunter_daemon stop + fi + + if [ -f /etc/init.d/init_qcom_audio ] + then + /etc/init.d/init_qcom_audio stop + fi + + if [ -f /etc/init.d/start_stop_qti_ppp_le ] + then + /etc/init.d/start_stop_qti_ppp_le stop + fi + + echo -n "Completed stopping miscellaneous daemons" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage misc-daemon { start | stop | restart}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/scripts/wavehunter_daemon b/scripts/wavehunter_daemon new file mode 100644 index 0000000..da469c4 --- /dev/null +++ b/scripts/wavehunter_daemon @@ -0,0 +1,27 @@ +#! /bin/sshell + +set -e + +case "$1" in +start) + echo -n "Starting wavehunter: " + start-stop-daemon -S -b --make-pidfile --pidfile /tmp/wavehunter.pid \ + --startas /bin/bash -- -c "exec /data/wavehunter/wavehunter > /data/wavehunter/wavehunter.log 2>&1" + echo "done" + ;; + stop) + echo -n "Stopping wavehunter: " + start-stop-daemon -K -p /tmp/wavehunter.pid + echo "done" + ;; + restart) + $0 stop + $0 start + ;; + *) + echo "Usage atfwd_daemon{ start | stop | restart }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/src/bin/wavehunter.rs b/src/bin/wavehunter.rs index ed923a8..ec4628c 100644 --- a/src/bin/wavehunter.rs +++ b/src/bin/wavehunter.rs @@ -9,11 +9,14 @@ fn main() -> DiagResult<()> { env_logger::init(); let mut dev = DiagDevice::new()?; - dev.enable_debug_mode("/data/wavehunter-debug")?; + dev.enable_debug_mode("/data/wavehunter/wavehunter-debug")?; dev.config_logs()?; + println!("The orca is hunting for stingrays..."); + let mut gsmtap_parser = GsmtapParser::new(); - let mut pcap_file = PcapFile::new("/data/wavehunter.pcap").unwrap(); + // We are going to want to add a timestamp to this pcap file eventually + let mut pcap_file = PcapFile::new("/data/wavehunter/wavehunter.pcap").unwrap(); pcap_file.write_iface_header().unwrap(); loop {