Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions src/app_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ impl AdminApp {
},
TabKind::Cert(x) => match &*x.result.lock().unwrap_or_else(|e| e.into_inner()) {
Some(Ok(c)) => {
format!("{}\n{}\n{} – {} ({} days left)\n{:?}", c.subject, c.issuer, c.not_before, c.not_after, c.days_left, c.trusted)
let trust = match &c.trusted {
Ok(()) => "trusted".to_string(),
Err(e) => format!("not trusted: {e}"),
};
format!("{}\n{}\n{} – {} ({} days left)\n{trust}", c.subject, c.issuer, c.not_before, c.not_after, c.days_left)
}
Some(Err(e)) => e.clone(),
None => String::new(),
Expand Down Expand Up @@ -176,8 +180,25 @@ impl AdminApp {
match args["tool"].as_str().unwrap_or("") {
"ping" => self.open_ping(target, PingMode::Ping, ctx),
"traceroute" => self.open_ping(target, PingMode::Trace, ctx),
"portscan" => self.open_scan(target),
"dns" => self.open_dns(target),
// a person presses "Scan" / "Query" in the tab; for an agent the tool starts
// right away, or reading the tab would give nothing
"portscan" => {
self.open_scan(target);
if let Some(Tab { kind: TabKind::Scan(s), .. }) = self.tabs.last_mut()
&& !s.host.trim().is_empty()
&& let Ok(ports) = crate::tools::parse_ports(&s.ports)
{
s.scan = Some(crate::tools::PortScan::start(&s.host, ports, s.timeout, ctx.clone()));
}
}
"dns" => {
self.open_dns(target);
if let Some(Tab { kind: TabKind::Dns(d), .. }) = self.tabs.last_mut()
&& !d.host.trim().is_empty()
{
dns_query(d, ctx);
}
}
"netscan" => {
self.open_netscan(target);
if let Some(Tab { kind: TabKind::NetScan(n), .. }) = self.tabs.last_mut()
Expand Down
10 changes: 5 additions & 5 deletions src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,13 +552,13 @@ fn launch_putty(e: &Entry, c: &Creds, settings: &Settings, jumps: &[JumpHop]) ->
}
let note = |old: bool| if old { tr(" – old PuTTY: the password is on its command line, please update PuTTY") } else { "" };
if chain_mode {
let dir = std::env::temp_dir().join("admincraft");
std::fs::create_dir_all(&dir).map_err(|err| err.to_string())?;
let file = dir.join(format!("putty-chain-{}.txt", e.id));
std::fs::write(&file, chain_remote_args(e, c, jumps).join(" ")).map_err(|err| err.to_string())?;
// the command PuTTY runs on the jump host names hosts and users: a private file that goes
// when PuTTY ends, like the password files
let file = crate::secretfile::write(&chain_remote_args(e, c, jumps).join(" "))?;
args.push("-t".into());
args.push("-m".into());
args.push(file.display().to_string());
args.push(file.path().display().to_string());
secrets.push(file);
args.push(first.host.trim().into());
let child = spawn(&putty, &args)?;
crate::secretfile::keep_while_running(child.id(), secrets);
Expand Down
Loading