mirror of
https://github.com/EFForg/rayhunter.git
synced 2026-05-31 10:13:35 -07:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f4a6c834d2 | |||
| 95e8f846d3 | |||
| 15f128add1 | |||
| 87f9cc403b | |||
| 7addf3a67f | |||
| 4d8cc9b738 | |||
| b0d797d206 | |||
| 1ae3b5020b | |||
| a23df84848 |
@@ -9,6 +9,7 @@ struct ConfigFile {
|
|||||||
debug_mode: Option<bool>,
|
debug_mode: Option<bool>,
|
||||||
ui_level: Option<u8>,
|
ui_level: Option<u8>,
|
||||||
enable_dummy_analyzer: Option<bool>,
|
enable_dummy_analyzer: Option<bool>,
|
||||||
|
colorblind_mode: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -18,6 +19,7 @@ pub struct Config {
|
|||||||
pub debug_mode: bool,
|
pub debug_mode: bool,
|
||||||
pub ui_level: u8,
|
pub ui_level: u8,
|
||||||
pub enable_dummy_analyzer: bool,
|
pub enable_dummy_analyzer: bool,
|
||||||
|
pub colorblind_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Config {
|
impl Default for Config {
|
||||||
@@ -28,6 +30,7 @@ impl Default for Config {
|
|||||||
debug_mode: false,
|
debug_mode: false,
|
||||||
ui_level: 1,
|
ui_level: 1,
|
||||||
enable_dummy_analyzer: false,
|
enable_dummy_analyzer: false,
|
||||||
|
colorblind_mode: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +45,7 @@ pub fn parse_config<P>(path: P) -> Result<Config, RayhunterError> where P: AsRef
|
|||||||
parsed_config.debug_mode.map(|v| config.debug_mode = v);
|
parsed_config.debug_mode.map(|v| config.debug_mode = v);
|
||||||
parsed_config.ui_level.map(|v| config.ui_level = v);
|
parsed_config.ui_level.map(|v| config.ui_level = v);
|
||||||
parsed_config.enable_dummy_analyzer.map(|v| config.enable_dummy_analyzer = v);
|
parsed_config.enable_dummy_analyzer.map(|v| config.enable_dummy_analyzer = v);
|
||||||
|
parsed_config.colorblind_mode.map(|v| config.colorblind_mode = v);
|
||||||
}
|
}
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -59,6 +59,7 @@ async fn run_server(
|
|||||||
debug_mode: config.debug_mode,
|
debug_mode: config.debug_mode,
|
||||||
analysis_status_lock,
|
analysis_status_lock,
|
||||||
analysis_sender,
|
analysis_sender,
|
||||||
|
colorblind_mode: config.colorblind_mode,
|
||||||
});
|
});
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
@@ -142,12 +143,17 @@ fn run_ctrl_c_thread(
|
|||||||
|
|
||||||
fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_shutdown_rx: oneshot::Receiver<()>, mut ui_update_rx: Receiver<framebuffer::DisplayState>) -> JoinHandle<()> {
|
fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_shutdown_rx: oneshot::Receiver<()>, mut ui_update_rx: Receiver<framebuffer::DisplayState>) -> JoinHandle<()> {
|
||||||
static IMAGE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/static/images/");
|
static IMAGE_DIR: Dir<'_> = include_dir!("$CARGO_MANIFEST_DIR/static/images/");
|
||||||
|
let mut display_color: framebuffer::Color565;
|
||||||
let display_level = config.ui_level;
|
let display_level = config.ui_level;
|
||||||
if display_level == 0 {
|
if display_level == 0 {
|
||||||
info!("Invisible mode, not spawning UI.");
|
info!("Invisible mode, not spawning UI.");
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut display_color = framebuffer::Color565::Green;
|
if config.colorblind_mode {
|
||||||
|
display_color = framebuffer::Color565::Blue;
|
||||||
|
} else {
|
||||||
|
display_color = framebuffer::Color565::Green;
|
||||||
|
}
|
||||||
|
|
||||||
task_tracker.spawn_blocking(move || {
|
task_tracker.spawn_blocking(move || {
|
||||||
let mut fb: Framebuffer = Framebuffer::new();
|
let mut fb: Framebuffer = Framebuffer::new();
|
||||||
|
|||||||
+9
-1
@@ -129,8 +129,16 @@ pub async fn start_recording(State(state): State<Arc<ServerState>>) -> Result<(S
|
|||||||
let qmdl_writer = QmdlWriter::new(qmdl_file);
|
let qmdl_writer = QmdlWriter::new(qmdl_file);
|
||||||
state.diag_device_ctrl_sender.send(DiagDeviceCtrlMessage::StartRecording((qmdl_writer, analysis_file))).await
|
state.diag_device_ctrl_sender.send(DiagDeviceCtrlMessage::StartRecording((qmdl_writer, analysis_file))).await
|
||||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send stop recording message: {}", e)))?;
|
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send stop recording message: {}", e)))?;
|
||||||
state.ui_update_sender.send(framebuffer::DisplayState::Recording).await
|
|
||||||
|
let display_state: framebuffer::DisplayState;
|
||||||
|
if state.colorblind_mode {
|
||||||
|
display_state = framebuffer::DisplayState::RecordingCBM;
|
||||||
|
} else {
|
||||||
|
display_state = framebuffer::DisplayState::Recording;
|
||||||
|
}
|
||||||
|
state.ui_update_sender.send(display_state).await
|
||||||
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send ui update message: {}", e)))?;
|
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, format!("couldn't send ui update message: {}", e)))?;
|
||||||
|
|
||||||
Ok((StatusCode::ACCEPTED, "ok".to_string()))
|
Ok((StatusCode::ACCEPTED, "ok".to_string()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ pub enum DisplayState {
|
|||||||
Recording,
|
Recording,
|
||||||
Paused,
|
Paused,
|
||||||
WarningDetected,
|
WarningDetected,
|
||||||
|
RecordingCBM,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<DisplayState> for Color565 {
|
impl From<DisplayState> for Color565 {
|
||||||
@@ -34,6 +35,7 @@ impl From<DisplayState> for Color565 {
|
|||||||
match state {
|
match state {
|
||||||
DisplayState::Paused => Color565::White,
|
DisplayState::Paused => Color565::White,
|
||||||
DisplayState::Recording => Color565::Green,
|
DisplayState::Recording => Color565::Green,
|
||||||
|
DisplayState::RecordingCBM => Color565::Blue,
|
||||||
DisplayState::WarningDetected => Color565::Red,
|
DisplayState::WarningDetected => Color565::Red,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -22,7 +22,8 @@ pub struct ServerState {
|
|||||||
pub ui_update_sender: Sender<framebuffer::DisplayState>,
|
pub ui_update_sender: Sender<framebuffer::DisplayState>,
|
||||||
pub analysis_status_lock: Arc<RwLock<AnalysisStatus>>,
|
pub analysis_status_lock: Arc<RwLock<AnalysisStatus>>,
|
||||||
pub analysis_sender: Sender<AnalysisCtrlMessage>,
|
pub analysis_sender: Sender<AnalysisCtrlMessage>,
|
||||||
pub debug_mode: bool
|
pub debug_mode: bool,
|
||||||
|
pub colorblind_mode: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_qmdl(State(state): State<Arc<ServerState>>, Path(qmdl_name): Path<String>) -> Result<Response, (StatusCode, String)> {
|
pub async fn get_qmdl(State(state): State<Arc<ServerState>>, Path(qmdl_name): Path<String>) -> Result<Response, (StatusCode, String)> {
|
||||||
|
|||||||
Vendored
+3
@@ -1,6 +1,9 @@
|
|||||||
# cat config.toml
|
# cat config.toml
|
||||||
qmdl_store_path = "/data/rayhunter/qmdl"
|
qmdl_store_path = "/data/rayhunter/qmdl"
|
||||||
port = 8080
|
port = 8080
|
||||||
|
debug_mode = false
|
||||||
|
enable_dummy_analyzer = false
|
||||||
|
colorblind_mode = false
|
||||||
# UI Levels:
|
# UI Levels:
|
||||||
# 0 = invisible mode, no indicator that rayhunter is running
|
# 0 = invisible mode, no indicator that rayhunter is running
|
||||||
# 1 = Subtle mode, display a green line at the top of the screen when rayhunter is running
|
# 1 = Subtle mode, display a green line at the top of the screen when rayhunter is running
|
||||||
|
|||||||
Vendored
+19
-11
@@ -42,11 +42,11 @@ wait_for_adb_shell() {
|
|||||||
|
|
||||||
setup_rootshell() {
|
setup_rootshell() {
|
||||||
_adb_push rootshell /tmp/
|
_adb_push rootshell /tmp/
|
||||||
"$SERIAL_PATH" "AT+SYSCMD=cp /tmp/rootshell /bin/rootshell"
|
_at_syscmd "cp /tmp/rootshell /bin/rootshell"
|
||||||
sleep 1
|
sleep 1
|
||||||
"$SERIAL_PATH" "AT+SYSCMD=chown root /bin/rootshell"
|
_at_syscmd "chown root /bin/rootshell"
|
||||||
sleep 1
|
sleep 1
|
||||||
"$SERIAL_PATH" "AT+SYSCMD=chmod 4755 /bin/rootshell"
|
_at_syscmd "chmod 4755 /bin/rootshell"
|
||||||
_adb_shell '/bin/rootshell -c id'
|
_adb_shell '/bin/rootshell -c id'
|
||||||
echo "we have root!"
|
echo "we have root!"
|
||||||
}
|
}
|
||||||
@@ -59,18 +59,26 @@ _adb_shell() {
|
|||||||
"$ADB" shell "$1"
|
"$ADB" shell "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_at_syscmd() {
|
||||||
|
"$SERIAL_PATH" "AT+SYSCMD=$1"
|
||||||
|
}
|
||||||
|
|
||||||
setup_rayhunter() {
|
setup_rayhunter() {
|
||||||
_adb_shell '/bin/rootshell -c "mkdir -p /data/rayhunter"'
|
_at_syscmd "mkdir -p /data/rayhunter"
|
||||||
_adb_push config.toml.example /data/rayhunter/config.toml
|
_adb_push config.toml.example /tmp/config.toml
|
||||||
_adb_push rayhunter-daemon /data/rayhunter/
|
_at_syscmd "mv /tmp/config.toml /data/rayhunter"
|
||||||
|
_adb_push rayhunter-daemon /tmp/rayhunter-daemon
|
||||||
|
_at_syscmd "mv /tmp/rayhunter-daemon /data/rayhunter"
|
||||||
_adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon
|
_adb_push scripts/rayhunter_daemon /tmp/rayhunter_daemon
|
||||||
|
_at_syscmd "mv /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"
|
||||||
_adb_push scripts/misc-daemon /tmp/misc-daemon
|
_adb_push scripts/misc-daemon /tmp/misc-daemon
|
||||||
_adb_shell '/bin/rootshell -c "cp /tmp/rayhunter_daemon /etc/init.d/rayhunter_daemon"'
|
_at_syscmd "mv /tmp/misc-daemon /etc/init.d/misc-daemon"
|
||||||
_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"'
|
_at_syscmd "chmod 755 /etc/init.d/rayhunter_daemon"
|
||||||
_adb_shell '/bin/rootshell -c "chmod 755 /etc/init.d/misc-daemon"'
|
_at_syscmd "chmod 755 /etc/init.d/misc-daemon"
|
||||||
|
|
||||||
echo -n "waiting for reboot..."
|
echo -n "waiting for reboot..."
|
||||||
_adb_shell '/bin/rootshell -c reboot'
|
_at_syscmd "shutdown -r -t 1 now"
|
||||||
|
|
||||||
# first wait for shutdown (it can take ~10s)
|
# first wait for shutdown (it can take ~10s)
|
||||||
until ! _adb_shell true 2> /dev/null
|
until ! _adb_shell true 2> /dev/null
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use serde::Serialize;
|
|||||||
|
|
||||||
use crate::{diag::MessagesContainer, gsmtap_parser};
|
use crate::{diag::MessagesContainer, gsmtap_parser};
|
||||||
|
|
||||||
use super::{imsi_provided::ImsiProvidedAnalyzer, information_element::InformationElement, lte_downgrade::LteSib6And7DowngradeAnalyzer, null_cipher::NullCipherAnalyzer};
|
use super::{/*imsi_provided::ImsiProvidedAnalyzer,*/ information_element::InformationElement, lte_downgrade::LteSib6And7DowngradeAnalyzer, null_cipher::NullCipherAnalyzer};
|
||||||
|
|
||||||
/// Qualitative measure of how severe a Warning event type is.
|
/// Qualitative measure of how severe a Warning event type is.
|
||||||
/// The levels should break down like this:
|
/// The levels should break down like this:
|
||||||
@@ -113,7 +113,7 @@ impl Harness {
|
|||||||
pub fn new_with_all_analyzers() -> Self {
|
pub fn new_with_all_analyzers() -> Self {
|
||||||
let mut harness = Harness::new();
|
let mut harness = Harness::new();
|
||||||
harness.add_analyzer(Box::new(LteSib6And7DowngradeAnalyzer{}));
|
harness.add_analyzer(Box::new(LteSib6And7DowngradeAnalyzer{}));
|
||||||
harness.add_analyzer(Box::new(ImsiProvidedAnalyzer{}));
|
//harness.add_analyzer(Box::new(ImsiProvidedAnalyzer{}));
|
||||||
harness.add_analyzer(Box::new(NullCipherAnalyzer{}));
|
harness.add_analyzer(Box::new(NullCipherAnalyzer{}));
|
||||||
|
|
||||||
harness
|
harness
|
||||||
|
|||||||
Reference in New Issue
Block a user