I am reading Windows event logs with JNA as below:
EventLogIterator iterator = new EventLogIterator("Security");
while (iterator.hasNext()) {
EventLogRecord curRecord = iterator.next();
}
But an exception is thrown (other channels like Application are read successfully):
Exception in thread "main" com.sun.jna.platform.win32.Win32Exception: A required privilege is not held by the client.
at com.sun.jna.platform.win32.Advapi32Util$EventLogIterator.<init>(Advapi32Util.java:1929)
at com.sun.jna.platform.win32.Advapi32Util$EventLogIterator.<init>(Advapi32Util.java:1922)
at com.emc.windowsagent.EventLogReader.getEventsByIterator(EventLogReader.java:155)
at com.emc.windowsagent.WindowsAgentMain.main(WindowsAgentMain.java:17)
Is there a way to obtain privilege to read Security events?
Run the application as Administrator.
Hi there Follow simple steps
To get the security logs from the windows we need to change the security permisions via regedit`.
Steps to follow
Type regedit in windows+run
Find
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Policies\system
In the right pane of System key, find EnableLUA DWORD and double click on it.
Then restart the operating system.And then add the java code
it will work.
Related
I have just installed dcm4chee4-4.4.0.Beta1, following INSTALL.md instructions and everything works fine except movescu test.
When I run this test I can see an error in standalone/log/server.log (previously I launched in another console storescp -b11115). This is the error:
2015-09-13 12:48:49,105 INFO [org.dcm4che3.net.Association] (pool-6-thread-7) DCM4CHEE<-MOVESCU(7): processing 1:C-MOVE-RQ[pcid=1, prior=0
cuid=1.2.840.10008.5.1.4.1.2.2.2 - Study Root Query/Retrieve Information Model - MOVE
tsuid=1.2.840.10008.1.2 - Implicit VR Little Endian failed. Caused by: org.dcm4che3.net.service.DicomServiceException: Unknown Move Destination: STORESCP#localhost:11115
at org.dcm4chee.archive.retrieve.scp.CMoveSCP.calculateMatches(CMoveSCP.java:184) [dcm4chee-arc-retrieve-scp-4.4.0.Beta1.jar:]
I think this is because of configuration, maybe I have to add STORESCP as acceptedAET or similar, but I can find info on how to do it. I search through ldap using Apache Directory Studio, but I didn't find anything.
Thanks in advance.
Using dcm4che3, it goes like this if you're implementing an SCP and need to define which other SCPs are allowed to C-STORE things to you.
// Usual calamity creating Connection, ApplicationEntity and Device
...
ApplicationEntity ae = new ApplicationEntity("MYAETITLE");
String[] acceptedAETs = { "STORESCP", "GEPACS" }; // etc...
ae.setAcceptedCallingAETitles(acceptedAETs);
I assume that your favourite SCP (STORESCP) may need to know where to find the SCP known by MYAETITLE; identified by IP address and port. Typically you connect to an SCP as a SCU, issuing a C-MOVE (in the scenario laid out here) instructing the SCP to do a C-STORE to the AET identified in the C-MOVE.
I'm a bit confused by your choice of AE Title in your question (STORESCP) because that indicates that you kind of mix up the two SCPs involved here; the one receiving the C-MOVE (which should not be called STORESCP :) and the one implementing the C-STORE behaviour. The answer I gave above, is aimed at the SCP implementing the C-STORE behaviour.
Using impersonation I tried to read a file located on the network in a shared folder. But I got the error "Access is denied". My source code is given below ...
This works fine for local resources. But gives error when access network resources. line
\sever\shared\abc.txt
// Create a provider that implements Windows authentication functions
IWindowsAuthProvider prov = new WindowsAuthProviderImpl();
// Login using different user
IWindowsIdentity identity = prov.logonDomainUser("abc.jim","abc.com", "Xyz#123");
IWindowsImpersonationContext context = identity.impersonate();
// Reading file using new user
readFile(); // It gives error - Access is denied
// Revert back to original logged user
context.revertToSelf();
readFile(); // It is working properly
// Cleanup the Windows identity
identity.dispose();
Finally i am able to solve this problem by creating one native C library using JNI.
Native windows API used are
LogonUser : http://msdn.microsoft.com/en-us/library/windows/desktop/aa378184(v=vs.85).aspx
ImpersonateLoggedOnUser : http://msdn.microsoft.com/en-us/library/windows/desktop/aa378612(v=vs.85).aspx
RevertToSelf : http://msdn.microsoft.com/en-us/library/windows/desktop/aa379317(v=vs.85).aspx
I'm experiencing some problems when trying to retrieve the slot information for VMware clusters with admission failover level control policy enabled. I use the VI Java API.
When calling the following method:
clusterComputeResource.retrieveDasAdvancedRuntimeInfo()
I either get the following Exception:
java.rmi.RemoteException: VI SDK invoke exception:java.rmi.RemoteException: Exception in
WSClient.invoke:; nested exception is:
java.lang.NoSuchFieldException: slotInfo
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:122)
at com.vmware.vim25.ws.VimStub.retrieveDasAdvancedRuntimeInfo(VimStub.java:269)
or I get the result which is of type ClusterDasAdvancedRuntimeInfo
but I need the subclass ClusterDasFailoverLevelAdvancedRuntimeInfo in order to get the SlotInfo field (casting to the required sublcass doesn't work either).
I tried to access the web service of a vcenter directly via Soap UI and it worked without any problems, but with the vijava API it just doesn't.
Thanks in advance for any help!!!
After a lot of of debugging to see what the VI Java API does internally, I found out that if the web service client (wsc) is invoked with the name of the sublcass instead of the name of the superclass (as last parameter), the response will be converted correctly. This way the slot information can be retrieved without any problems. Here is the solution for those experiencing the same problems:
ClusterDasFailoverLevelAdvancedRuntimeInfo clusterDasFailoverLevelAdvancedRuntimeInfo = null;
try {
final Argument[] paras = new Argument[1];
paras[0] = new Argument("_this", "ManagedObjectReference", clusterComputeResource.getMOR());
clusterDasFailoverLevelAdvancedRuntimeInfo = (ClusterDasFailoverLevelAdvancedRuntimeInfo) serviceInstance.getServerConnection().getVimService().getWsc().invoke("RetrieveDasAdvancedRuntimeInfo", paras, "ClusterDasFailoverLevelAdvancedRuntimeInfo");
} catch (final Exception e) {
//error handling
}
(Note that this only works if admission control failover level policy is enabled!!!)
I am in need to somehow display image on Linux console. Why am I need it?
I need to manually enter CAPTCHA code. However my application runs on remote linux system and I am connecting to it via SSH (Bitwise client). I have thought about writing directly to screen, but hey - I see only "clone" of terminal not the remote terminal itself so this is impossible to achieve. Maybe some kind of Img2Asci converter? Please advise.
You want to forward your X session.
on the remote system make sure xauth is installed.
on the client system make sure an X client is installed (Xming for windows)
Connect with ssh -X from a command line or with putty enable X forwarding.
You can then either use display filename or most applications that so that sort of thing will pop up if a display is detected
Assuming you can't forward your X session, perhaps something like jp2a, which converts JPEG to ASCII ?
convert http://www.google.com/intl/en/images/logo.gif jpg:- | jp2a -
....... .':.
.::'....':xd. dX'
.ld. .. . oX. ...
;O' .c;..'cxc ;,...,c;. .:'.,lxc. dX. ,:'.,dx.. .
oO. .ox. ,x0 .cd. .cd..ll l0. xX. :K,..,::.
cxx. .',cl 'x0 lK'.cx ;k, lO; .ll. dX. o0:
,dkc. :kd :kx. :d; ,ol. .lc. .''lk' kX' oOo'...
.;:cc;,,',,. .;;,'.. .,,'... ''',:lxo. .','. .,::;.
.oc. dO
lk;....'c'
.'....
I experience a strange problem. Sometimes our Java app will not start and will raise an IOException when trying to open a OtpNode. Here is the code (really nothing special):
OtpNode oNode = new OtpNode(NODE);
oNode.setCookie(COOKIE);
OtpMbox mbox = oNode.createMbox(MBOX);
NODE, COOKIE and MBOX are hardcoded constants. The error I get is:
class java.io.IOException,
'Nameserver not responding on Martin-PC when publishing jnode',
Stack trace: [Ljava.lang.StackTraceElement;#c3ea5a
That's it. And this happens only sometimes. I observed that when restarting the PC it happens.
Had anyone seen similar problem?
Thank you.
It turned out that after restrat the Erlang virtual machine sometimes is not running. So we need to start it first before Java OtpNode could be started:
erl -sname whatever
http://www.erlang.org/doc/man/erl.html