Merge pull request #13 from EFForg/scripts

adding init.d scripts and updating makefile
This commit is contained in:
Cooper Quintin
2023-12-16 10:40:32 -08:00
committed by GitHub
4 changed files with 137 additions and 4 deletions

View File

@@ -1,2 +1,3 @@
cross rustc --target armv7-unknown-linux-gnueabihf -- -C target-feature=+crt-static cargo build
adb push target/armv7-unknown-linux-gnueabihf/debug/diag /tmp/diag 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

102
scripts/misc-daemon Normal file
View File

@@ -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

27
scripts/wavehunter_daemon Normal file
View File

@@ -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

View File

@@ -9,11 +9,14 @@ fn main() -> DiagResult<()> {
env_logger::init(); env_logger::init();
let mut dev = DiagDevice::new()?; let mut dev = DiagDevice::new()?;
dev.enable_debug_mode("/data/wavehunter-debug")?; dev.enable_debug_mode("/data/wavehunter/wavehunter-debug")?;
dev.config_logs()?; dev.config_logs()?;
println!("The orca is hunting for stingrays...");
let mut gsmtap_parser = GsmtapParser::new(); 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(); pcap_file.write_iface_header().unwrap();
loop { loop {