-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit f5ea6be.
- Loading branch information
Devdutt Shenoi
committed
Dec 14, 2022
1 parent
5dca975
commit 80eb6f1
Showing
13 changed files
with
109 additions
and
200 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
fn main() { | ||
let logcat_re = regex::Regex::new(r#"^(\S+ \S+) (\w)/([^(\s]*).+?:\s*(.*)$"#).unwrap(); | ||
let line = "07-25 08:52:02.552 W//apex/com.android.adbd/bin/adbd( 367): type=1400 audit(0.0:21653): avc: denied { search } for comm=73796E6320737663203635 name=\"oem\" dev=\"dm-4\" ino=42 scontext=u:r:adbd:s0 tcontext=u:object_r:oemfs:s0 tclass=dir permissive=0"; | ||
let data = logcat_re.captures(line); | ||
dbg!(data); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
use futures_util::SinkExt; | ||
use serde::{Deserialize, Serialize}; | ||
use std::time::{SystemTime, UNIX_EPOCH}; | ||
use tokio::net::TcpStream; | ||
use tokio_stream::StreamExt; | ||
use tokio_util::codec::{Framed, LinesCodec}; | ||
use uplink::Action; | ||
|
||
#[derive(Debug, Serialize, Deserialize)] | ||
struct Response { | ||
stream: String, | ||
sequence: u32, | ||
timestamp: u64, | ||
action_id: String, | ||
state: String, | ||
progress: u8, | ||
errors: Vec<String>, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let port = std::env::args().nth(1).unwrap_or_else(|| "127.0.0.1:5555".to_string()); | ||
let stream = TcpStream::connect(port).await.unwrap(); | ||
let mut framed = Framed::new(stream, LinesCodec::new()); | ||
let mut idx = 1; | ||
loop { | ||
let action_s = framed.next().await.unwrap().unwrap(); | ||
println!("Received: {}", action_s); | ||
let action = serde_json::from_str::<Action>(action_s.as_str()).unwrap(); | ||
idx += 1; | ||
let response = Response { | ||
stream: "action_status".to_string(), | ||
sequence: idx, | ||
timestamp: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64, | ||
action_id: action.action_id, | ||
state: "Completed".to_string(), | ||
progress: 100, | ||
errors: vec![], | ||
}; | ||
let resp = serde_json::to_string(&response).unwrap(); | ||
println!("Sending: {}", resp); | ||
framed.send(resp).await.unwrap(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.