From 7a8648da9cd0652858200837587a93ff35d0318c Mon Sep 17 00:00:00 2001 From: eta Date: Sat, 31 Dec 2022 15:08:25 +0000 Subject: [PATCH] add sub utn, decrease verbosity --- src/main.rs | 12 +----------- src/payload.rs | 4 +++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main.rs b/src/main.rs index 35f22ca..d35d41c 100644 --- a/src/main.rs +++ b/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 { diff --git a/src/payload.rs b/src/payload.rs index 1a33c5e..d289346 100644 --- a/src/payload.rs +++ b/src/payload.rs @@ -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 { + pub fn decode(tkt: &[u8], issuer_id: String, sub_utn: String) -> anyhow::Result { let bit_tkt = tkt.view_bits::(); let manually_inspect = bit_tkt[0]; @@ -281,6 +282,7 @@ impl Rsp6Ticket { osi_nlc, mystery_flag, mystery_header, + sub_utn, }) } }