-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello Yanjin,
Tested wmi connect on Windows XP SP3 and is working fine.
Attaching a small NASL script, please check is it working or not.
We will try to reproduce the issue, please provide which platform you
are using.
openvas-nasl -X wmi_connect_test.nasl -t 192.168.1.230
NASL script out put :
=====================
User Name : test
Passwd : test
Host : 192.168.1.230
Connected to host with handle 152144128
Executing wmi query : SELECT IPAddress, MacAddress, Description FROM
Win32_NetworkAdapterConfiguration Where IPEnabled = True
Query Result : Description|Index|IPAddress|MACAddress
VMware Accelerated AMD PCNet Adapter - Packet Scheduler
Miniport|1|192.168.1.230|00:0a:11:64:01:7A
VMware Accelerated AMD PCNet Adapter - Packet Scheduler
Miniport|10|192.168.1.230|00:0a:11:64:01:7A
Thanks!
Veerendra
On Tuesday 14 May 2013 01:45 AM, Yanjin Ding wrote:
> Dear all,
>
> I'm having problem with connecting and querying through wmi. The log says:
> WMI Connect Failed.
>
> I used "wmic" from command line, it's able to get RSOP results back. I also
> used "gpresult" which is a microsoft tool to query RSOP data, and it's
> working. I believe the host configuration with WMI is correct.
>
> But openvas still can't connect through WMI. I installed wmi following
> instructions here:
> http://code.ohloh.net/file?fid=FUi4Z0R3xgX0oCjcpy4vdQq7eec&cid=MQKpc2gZPvw&s=&browser=Default#L0
> .
>
> Also I wrote a test nasl script, first set host, username and password
> properly, then call the function:
> wmi_connect(host:host, username:usrname, password:passwd);
> and run the script using openvas-nasl. It printed our error message:
>
> [librpc/rpc/dcerpc_connect.c:329:dcerpc_pipe_connect_ncacn_ip_tcp_recv()]
> failed NT status (c0000236) in dcerpc_pipe_connect_ncacn_ip_tcp_recv
> [librpc/rpc/dcerpc_connect.c:790:dcerpc_pipe_connect_b_recv()] failed NT
> status (c0000236) in dcerpc_pipe_connect_b_recv
> nasl_wmi_connect: WMI Connect failed
>
> I'm using openvas 6 libraries and wmi 1.3.14.
>
> Can anyone help me out? Thank you in advance.
> *--*
> *Yanjin Ding*
>
>
>
> _______________________________________________
> Openvas-devel mailing list
> [email protected]
> https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-devel
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQEcBAEBAgAGBQJRkhkUAAoJEFdbOg70fJiaZoIIAICX5e4FdmdBqpatPMocHOeR
3qmwFgbyxSDGfzS+wxgzjxDEMQThiXSe2W6rRgdkNo54GmL68ChSpNmDtzD+cL9F
awfp7eqR0SyIoobowiuCkS072pDp4HzoDuumBhupgo02sNrfdOsNLsloS7kJjm64
t0sPqPtt9rCDA5O+pnvKO/mM81OSu7HJTh99z+WQC/irsbvG5cN3VL8AKvCZONLZ
mXmSx4IXwwsGT5TTVzzSOjPKYSODTIzxJlp0TeuDLLKfEQUBKHyW7o2KsGkWkA+N
7JxuCAN8rUqpUxAt6ai9Sdv3pz4zx1lnY/MY+nMP/PuhAFQbm/ggxvpGu79o7JY=
=pMyg
-----END PGP SIGNATURE-----
include("wmi_file.inc");
include("wmi_os.inc");
## Variables Initialization
host = "";
usrname = "";
passwd = "";
handle = "";
usrname = "add-username";
passwd = "add-password";
host = get_host_ip();
security_note(data:"User Name : "+usrname);
security_note(data:"Passwd : "+passwd);
security_note(data:"Host : "+host);
if(!host || !usrname || !passwd){
security_note(data:string("\nImproper info provided"));
exit(0);
}
## Connect using WMI
handle = wmi_connect(host:host, username:usrname, password:passwd);
if(!handle){
security_note(data:string("\nFailed to get handle "));
exit(0);
}
security_note(data:string("\nConnected to host with handle ", handle));
## WMI query to grep the file version
query = 'SELECT IPAddress, MacAddress, Description FROM Win32_NetworkAdapter' +
'Configuration Where IPEnabled = True';
security_note(data:string("\nExecuting wmi query : ", query));
## Execute wmi query
query_res = wmi_query(wmi_handle:handle, query:query);
security_note(data:string("\nQuery Result : ", query_res));
exit(0);
_______________________________________________
Openvas-discuss mailing list
[email protected]
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-discuss