modified: src/client.rs
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
Some checks failed
gitea/Frida-android-native/pipeline/head There was a failure building this commit
This commit is contained in:
parent
e481f4c2cf
commit
5514074861
@ -122,31 +122,30 @@ pub async fn client_mode(client_config: ClientConfiguration, fd: i32, env: &JNIE
|
|||||||
|
|
||||||
let s_cipher = cipher_shared.clone();
|
let s_cipher = cipher_shared.clone();
|
||||||
loop {
|
loop {
|
||||||
tokio::select! {
|
if let Ok(bytes) = lrx.try_recv() {
|
||||||
b = lrx.recv() => {
|
FridaLib::traceFromNative(&env, String::from_utf8_lossy(&bytes).to_string());
|
||||||
FridaLib::traceFromNative(&env, String::from_utf8_lossy(&b.unwrap()).to_string());
|
}
|
||||||
}
|
if let Ok(bytes) = mx.try_recv() {
|
||||||
b = mx.recv() => {
|
let s_c = s_cipher.lock().await;
|
||||||
let bytes = b.unwrap();
|
|
||||||
let s_c = s_cipher.lock().await;
|
|
||||||
|
|
||||||
if s_c.is_some() {
|
if s_c.is_some() {
|
||||||
let aes = Aes256Gcm::new(s_c.as_ref().unwrap().as_bytes().into());
|
let aes = Aes256Gcm::new(s_c.as_ref().unwrap().as_bytes().into());
|
||||||
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
|
let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
|
||||||
let ciphered_data = aes.encrypt(&nonce, &bytes[..]);
|
let ciphered_data = aes.encrypt(&nonce, &bytes[..]);
|
||||||
|
|
||||||
if let Ok(ciphered_d) = ciphered_data {
|
if let Ok(ciphered_d) = ciphered_data {
|
||||||
let vpn_packet = UDPVpnPacket{ data: ciphered_d, nonce: nonce.to_vec()};
|
let vpn_packet = UDPVpnPacket{ data: ciphered_d, nonce: nonce.to_vec()};
|
||||||
let serialized_data = vpn_packet.serialize();
|
let serialized_data = vpn_packet.serialize();
|
||||||
ltx.send("Write to socket".as_bytes().to_vec());
|
ltx.send("Write to socket".as_bytes().to_vec());
|
||||||
sock_snd.send(&serialized_data).await.unwrap();
|
sock_snd.send(&serialized_data).await.unwrap();
|
||||||
} else {
|
|
||||||
ltx.send("Socket encryption failed.".as_bytes().to_vec());
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ltx.send("There is no shared_secret in main loop".as_bytes().to_vec());
|
ltx.send("Socket encryption failed.".as_bytes().to_vec());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ltx.send("There is no shared_secret in main loop".as_bytes().to_vec());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user