mirror of
https://git.eta.st/eta/rsp6-decoder.git
synced 2024-11-24 02:25:38 +00:00
add sub utn, decrease verbosity
This commit is contained in:
parent
1bb6e5cff8
commit
7a8648da9c
12
src/main.rs
12
src/main.rs
@ -71,7 +71,6 @@ fn main() -> anyhow::Result<()> {
|
||||
let issuer_id = &ticket_str[13..15];
|
||||
let ticket_reference = format!("{}{}", issuer_id, &ticket_str[2..11]);
|
||||
eprintln!("[+] RSP6 ticket, reference {}", ticket_reference);
|
||||
eprintln!("[+] Ticket issuer: {}", issuer_id);
|
||||
let ticket = base26_decode(&ticket_str[15..]);
|
||||
let keys = iks
|
||||
.keys
|
||||
@ -82,16 +81,7 @@ fn main() -> anyhow::Result<()> {
|
||||
let message = message.to_bytes_be();
|
||||
if let Some(unpadded) = strip_padding(&message) {
|
||||
eprintln!("[+] decrypt done!");
|
||||
let ticket_ref_inner = Rsp6Ticket::base64(unpadded, 8, 62);
|
||||
let extra_bit = Rsp6Ticket::base64(unpadded, 62, 68);
|
||||
let inner_data = format!("{}{}", ticket_ref_inner, extra_bit);
|
||||
let outer_data = &ticket_str[2..12];
|
||||
if inner_data != outer_data {
|
||||
eprintln!("[-] checksum mismatch: {} vs {}", inner_data, outer_data);
|
||||
} else {
|
||||
eprintln!("[+] checksum ok");
|
||||
}
|
||||
let ticket = Rsp6Ticket::decode(unpadded, issuer_id.into())?;
|
||||
let ticket = Rsp6Ticket::decode(unpadded, issuer_id.into(), ticket_str[11..13].into())?;
|
||||
serde_json::to_writer_pretty(std::io::stdout(), &ticket)?;
|
||||
return Ok(());
|
||||
} else {
|
||||
|
@ -67,6 +67,7 @@ pub struct Rsp6Ticket {
|
||||
pub manually_inspect: bool,
|
||||
pub issuer_id: String,
|
||||
pub ticket_reference: String,
|
||||
pub sub_utn: String,
|
||||
pub checksum: char,
|
||||
pub version: u8,
|
||||
pub standard_class: bool,
|
||||
@ -144,7 +145,7 @@ impl Rsp6Ticket {
|
||||
Some(format!("{}{:04}", prefix, (id % 10000)))
|
||||
}
|
||||
|
||||
pub fn decode(tkt: &[u8], issuer_id: String) -> anyhow::Result<Self> {
|
||||
pub fn decode(tkt: &[u8], issuer_id: String, sub_utn: String) -> anyhow::Result<Self> {
|
||||
let bit_tkt = tkt.view_bits::<Msb0>();
|
||||
|
||||
let manually_inspect = bit_tkt[0];
|
||||
@ -281,6 +282,7 @@ impl Rsp6Ticket {
|
||||
osi_nlc,
|
||||
mystery_flag,
|
||||
mystery_header,
|
||||
sub_utn,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user