Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix release #53

Merged
merged 5 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
107 changes: 46 additions & 61 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ tokio-util = { version = "0.7.10", features = ["rt"] }
futures-macro = "0.3.30"
include_dir = "0.7.3"
mime_guess = "2.0.4"
tempdir = "0.3.7"
chrono = { version = "0.4.31", features = ["serde"] }
tokio-stream = "0.1.14"
futures = "0.3.30"
clap = { version = "4.5.2", features = ["derive"] }
serde_json = "1.0.114"
image = "0.25.1"
tempfile = "3.10.1"
12 changes: 8 additions & 4 deletions bin/src/qmdl_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,16 @@ impl RecordingStore {

#[cfg(test)]
mod tests {
use tempdir::TempDir;
use tempfile::{TempDir, Builder};
use super::*;

fn make_temp_dir() -> TempDir {
Builder::new().prefix("qmdl_store_test").tempdir().unwrap()
}

#[tokio::test]
async fn test_load_from_empty_dir() {
let dir = TempDir::new("qmdl_store_test").unwrap();
let dir = make_temp_dir();
assert!(!RecordingStore::exists(dir.path()).await.unwrap());
let _created_store = RecordingStore::create(dir.path()).await.unwrap();
assert!(RecordingStore::exists(dir.path()).await.unwrap());
Expand All @@ -218,7 +222,7 @@ mod tests {

#[tokio::test]
async fn test_creating_updating_and_closing_entries() {
let dir = TempDir::new("qmdl_store_test").unwrap();
let dir = make_temp_dir();
let mut store = RecordingStore::create(dir.path()).await.unwrap();
let _ = store.new_entry().await.unwrap();
let entry_index = store.current_entry.unwrap();
Expand All @@ -237,7 +241,7 @@ mod tests {

#[tokio::test]
async fn test_repeated_new_entries() {
let dir = TempDir::new("qmdl_store_test").unwrap();
let dir = make_temp_dir();
let mut store = RecordingStore::create(dir.path()).await.unwrap();
let _ = store.new_entry().await.unwrap();
let entry_index = store.current_entry.unwrap();
Expand Down
32 changes: 19 additions & 13 deletions dist/install-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,28 @@ check_adb() {
}

force_debug_mode() {
echo " Force a switch into the debug mode to enable ADB"
echo "Force a switch into the debug mode to enable ADB"
"$SERIAL_PATH" --root
echo -n "adb enabled, waiting for reboot"
echo -n "adb enabled, waiting for reboot..."
wait_for_adb_shell
echo "it's alive!"
echo " it's alive!"
echo -n "waiting for atfwd_daemon to startup..."
wait_for_atfwd_daemon
echo " done!"
}

wait_for_atfwd_daemon() {
until [ -n "$(adb shell 'pgrep atfwd_daemon')" ]
do
sleep 1
done
}

wait_for_adb_shell() {
until adb shell true 2> /dev/null
do
echo -n .
sleep 1
done
echo
}

setup_rootshell() {
Expand All @@ -43,8 +51,8 @@ setup_rootshell() {
"$SERIAL_PATH" "AT+SYSCMD=chown root /bin/rootshell"
sleep 1
"$SERIAL_PATH" "AT+SYSCMD=chmod 4755 /bin/rootshell"
echo "we have root!"
adb shell /bin/rootshell -c id
echo "we have root!"
}

_adb_push() {
Expand All @@ -61,36 +69,34 @@ setup_rayhunter() {
adb shell '/bin/rootshell -c "cp /tmp/misc-daemon /etc/init.d/misc-daemon"'
adb shell '/bin/rootshell -c "chmod 755 /etc/init.d/rayhunter_daemon"'
adb shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"'
echo -n "rebooting, this may take a sec..."
echo -n "waiting for reboot..."
adb shell '/bin/rootshell -c reboot'

# first wait for shutdown (it can take ~10s)
until ! adb shell true 2> /dev/null
do
echo -n '.'
sleep 1
done

# now wait for boot to finish
wait_for_adb_shell

echo "rebooted successfully!"
echo " done!"
}

test_rayhunter() {
URL="http://localhost:8080"
adb forward tcp:8080 tcp:8080
adb forward tcp:8080 tcp:8080 > /dev/null
echo -n "checking for rayhunter server..."

SECONDS=0
while (( SECONDS < 30 )); do
if curl -L --fail-with-body "$URL" -o /dev/null -s; then
echo
echo "success! you can access rayhunter at $URL"
echo "success!"
echo "you can access rayhunter at $URL"
return
fi
sleep 1
echo -n "."
done
echo "timeout reached! failed to reach rayhunter url $URL, something went wrong :("
}
2 changes: 1 addition & 1 deletion lib/src/analysis/null_cipher.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;

use telcom_parser::lte_rrc::{CipheringAlgorithm_r12, DL_CCCH_MessageType, DL_CCCH_MessageType_c1, DL_DCCH_MessageType, DL_DCCH_MessageType_c1, PCCH_MessageType, PCCH_MessageType_c1, PagingUE_Identity, RRCConnectionReconfiguration, RRCConnectionReconfigurationCriticalExtensions, RRCConnectionReconfigurationCriticalExtensions_c1, RRCConnectionReconfiguration_r8_IEs, RRCConnectionRelease_v890_IEs, SCG_Configuration_r12, SecurityConfigHO_v1530HandoverType_v1530, SecurityModeCommand, SecurityModeCommandCriticalExtensions, SecurityModeCommandCriticalExtensions_c1};
use telcom_parser::lte_rrc::{CipheringAlgorithm_r12, DL_DCCH_MessageType, DL_DCCH_MessageType_c1, RRCConnectionReconfiguration, RRCConnectionReconfigurationCriticalExtensions, RRCConnectionReconfigurationCriticalExtensions_c1, SCG_Configuration_r12, SecurityConfigHO_v1530HandoverType_v1530, SecurityModeCommand, SecurityModeCommandCriticalExtensions, SecurityModeCommandCriticalExtensions_c1};

use super::analyzer::{Analyzer, Event, EventType, Severity};
use super::information_element::{InformationElement, LteInformationElement};
Expand Down
Loading
Loading