diff --git a/trunk/report_templates/SYSTEM_CurrentNetworkSettings.qs b/trunk/report_templates/SYSTEM_CurrentNetworkSettings.qs new file mode 100644 index 0000000..cd5b647 --- /dev/null +++ b/trunk/report_templates/SYSTEM_CurrentNetworkSettings.qs @@ -0,0 +1,91 @@ +function print_table_row(cell01,cell02) { + println(" ",cell01,"",cell02,""); +} + +// Global vars +var val; + +// Get current controlset +var cur_controlset=GetRegistryKeyValue("\\Select","Current"); +cur_controlset=RegistryKeyValueToString(cur_controlset.value,cur_controlset.type); +// Current holds a DWORD value, thus we get a string like 0x00000000, but +// control sets are referenced only with the last 3 digits. +cur_controlset="ControlSet"+String(cur_controlset).substr(7,3); + +println(""); +println(" Current Network Settings (Tcp/Ip)"); +println(" "); +println("

Current network settings (Tcp/Ip)

"); +println("

"); +println(" "); + +print_table_row("Active control set:",cur_controlset); + +// Computer name +val=GetRegistryKeyValue(cur_controlset+"\\Control\\ComputerName\\ComputerName","ComputerName"); +print_table_row("Computer name:",RegistryKeyValueToString(val.value,val.type)); + +println("
"); +println("
"); + +// Iterate over all available network adapters +var adapters=GetRegistryNodes(cur_controlset+"\\Services\\Tcpip\\Parameters\\Adapters"); +for(var i=0;i"); + + // Get configuration mode + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"EnableDHCP"); + val=Number(RegistryKeyValueToString(val.value,val.type)); + if(val) { + // DHCP enabled + print_table_row("Configuration mode:","DHCP"); + // DHCP server + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DhcpServer"); + print_table_row("Last used DHCP server:",RegistryKeyValueToString(val.value,val.type)); + // IP address + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DhcpIPAddress"); + print_table_row("IP address:",RegistryKeyValueToString(val.value,val.type)); + // Subnet mask + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DhcpSubnetMask"); + print_table_row("Subnet mask:",RegistryKeyValueToString(val.value,val.type)); + // Nameserver(s) + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DhcpNameServer"); + print_table_row("Nameserver(s):",RegistryKeyValueToString(val.value,val.type)); + // Default gw + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DhcpDefaultGateway"); + print_table_row("Default gateway:",RegistryKeyValueToVariant(val.value,"utf16",0)); + // Lease obtained + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"LeaseObtainedTime"); + print_table_row("Lease obtained:",RegistryKeyValueToVariant(val.value,"unixtime",0)); + // Lease valid until + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"LeaseTerminatesTime"); + print_table_row("Lease terminates:",RegistryKeyValueToVariant(val.value,"unixtime",0)); + } else { + print_table_row("Configuration mode:","Manual"); + // IP address + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"IPAddress"); + print_table_row("IP address:",RegistryKeyValueToVariant(val.value,"utf16",0)); + // Subnet mask + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"SubnetMask"); + print_table_row("Subnet mask:",RegistryKeyValueToVariant(val.value,"utf16",0)); + // Nameserver + // TODO: Has to be validated + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"NameServer"); + if(typeof val !== 'undefined') print_table_row("Nameserver:",RegistryKeyValueToVariant(val.value,"utf16",0)); + // Default gw + val=GetRegistryKeyValue(cur_controlset+"\\Services\\"+adapter_settings_node,"DefaultGateway"); + print_table_row("Default gateway:",RegistryKeyValueToVariant(val.value,"utf16",0)); + } + + println(" "); + println("
"); +} + +println("

"); +println("");