checking browser history from cmd or java - java

Is there any way I can check my browser history via java program or command line?
My requirement is I need to check how many times a person has accessed a particular site in a day from the browser.
Is there any way I can achieve this ?

You can view cached DNS entries from CMD.
Every time you browse to a web page, your PC has to request the IP Address for that web site from your default DNS server, and then caches them locally on your machine for a while to speed up future access to that web site — even in a private browsing session.
You can see these for yourself by opening up a command prompt and typing in ipconfig /displaydns to see the full list of cached DNS entries.
Now, the first thing you’ll notice is that a whole lot of information will appear, to the point that all of it can’t fit in the command prompt. What you can do is take the output of the command and send it to a text file somewhere on your machine.
ipconfig /displaydns > c:\desired location
Now, when you open that file you’ll see information about the websites you've visited directly or indirectly.

Related

How to execute MSDOS Command from browser (PHP or Java)

I have a USB line display, similar to the ones that are used in store point of sale systems.
To print ABC to this line display, I run the following command:
echo ABC > \\.\LCLD9\
This prints ABC to the line display.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
This is indeed not possible on an unmodified system. There is no way for a web page to run an arbitrary command on the user's machine -- that is the definition of a security vulnerability.
If you can get the user to install software ahead of time, you could use a Chrome extension with the serial, usb
or nativeMessaging APIs to expose this functionality to web pages.
Check out function shell_exec. http://php.net/manual/en/function.shell-exec.php
There are several ways to do this. One way is to simply have your website store the current text somewhere and then build a script on the local PC that asks your website for the current text and updates the display. You can schedule that script to run periodically using the Task Scheduler.
This script can be as simple as this (assuming PHP is installed on your local PC):
<?php
$text = file_get_contents('https://example.com/current_text.php');
shell_exec('echo "' . $text . '" > \\.\LCLD9\');
If you don't have PHP installed and don't want to install it, you can probably do something similar in a Powershell script or in a plain old batch file.
Note that you probably want to add some extra checks to this, you don't want to accidentally clutter your display with a 404 error page, a 500 internal server error or a network error.

User Permission in Jenkins

Inside Jenkins Jobs & Builds folder, I am creating a text file and writing some content through Java program. As I am part of corporate network, I am inside firewall with many security rules where I have been restricted to write/update the program files directory under C: drive. Although I am administrator in my local machine, however the company policies are still applied which is denying me access to write/delete any files from the Jenkins directory. I see Jenkins is nicely reading/modifying/writing any files/folders without any issues which is believed to the typical behavior of Jenkins's USER.
Question 1: Is there any way I can use this Jenkins's user through my code so I can avail access on to these directories?
Question 2: Are there ways to solve this issue through Java code? (Note: I have tried writing a file with Run as Administration java code as well)
Kindly let me know if I am missing any details,.any help is highly appreciated.
It's about the user who launched the jenkins server, who might have the permissions to access the directories.
You can use the same user for your operations if available.
Question 1: Is there any way I can use this Jenkins's user through my code so I can avail access on to these directories?
Jenkins users - Jenkins server can have its own users and privileges can be set for each users differently. You cannot use these users outside of Jenkins server.
You can use the user who launched the Jenkins server, must be a user at OS level.
Question 2: Are there ways to solve this issue through Java code? (Note: I have tried writing a file with Run as Administration java code as well)
Again, only OS level users can be used and not the Jenkins users(users created inside Jenkins server)
If you want your application to run with same credentials as Jenkins user, then hold Shift+Right Click your application, select "Run as different user", provide Jenkins's user credentials and press OK.
If you are launching your Java application from command line, do the Shift+Right Click on the cmd.exe first, and once again select "Run as different user"
If you want to impersonate a Windows user from within code, then you should really reword your question body and title (and remove Jenkins references as it has nothing to do with this). But even in this case, you need to know the credentials of the user you are trying to impersonate

Getting system's hardware information of a connected user to a PHP website ? Is it possible?

I am posting this in order to confirm if it is possible for PHP to get a user's machine hardware information when connected to a website?
In my case I am developing an Intranet which requires one user - one machine login. Which means a user assigned to his/ her machine can only login, others cannot login from that particular machine. In this regard, my database and PHP Code is already up and running without machine dependency.
I presume it is not possible because PHP is a Server Side code which requires none of the User's system resources to get in touch with. To get system's hardware information - some application must be installed in user's machine to get it done. But is this possible in any regard for example a PHP Desktop application (though not in development) or any Java application to check machine's information and get appended it to Normal user's login.
Awaiting experts solutions...
It depends what information you need. The HTTP Headers contain the user agent (what browers/OS) of the origin, the IP address and a few other things that the server needs in order to process the request, but you can't get for instance the brand of keyboard connected to that machine.
Simple: IMPOSSIBLE! As php will output text to a browser and the browser can gather some data, but only a little (like screen resolution, colors, IP and things that are not vurnelable.). But no, PHP cannot access hardware information.
You can use the IP address to know which machine it is only if your DHCP does not change the IP at each deconnexion.
You can also use the REMOTE_USER_AGENT super global to know more informations. Apart from an ajax request that can send datas that your security policy allows the browser to get, I see no solution for your problem.

How do I force Java applications to log onto a network proxy?

I am attempting to run a Java application (specifically Minecraft) at my school on a mac computer. I wish to play online on my personal server, however the way the network is set up here the only way to access the internet is to enter network user/pass (The school uses a websense filter). Each student has one, and when you open a browser window a prompt will automatically ask me for it. The same user/pass is used to log into the machine, and some software will simply pick it up and go online without entering it a second time (ex. Safari just connects, Chrome however prompts for the user/pass).
Java applications however seem to be a mixed bag, some will connect, some will not. However none of them prompt me for the user/pass to the network.
So is there any way to force possibly through command line?) a Java application to log into the network?
Or is there possibly some other problem here?
You can set the proxy at the command line. This should help you: How do I set the proxy to be used by the JVM
In case you can't use your proxy directly you might try and install a local proxy such as CNTLM that connects to your network proxy and authenticates using the credentials you provide. The application would then not have to provide credentials. However, you'd have to provide your network credentials to CNTLM and thus should not forget to remove them when you are done.

How can I code a web app p2p network?

I wanted to code a web application, where one user can choose a file and other multiple users can download that specified file off of that user's computer. That user would have to leave his computer on and leave the web page open.
I dont want to have a big main server that has to handle all that traffic. That user's computer is the server, persay. I understand I'll use torrent.
All this has to be done on a website.
Will a web socket work?
Please and Thanks.
This really isn't possible for a variety of reasons:
Firewalls / NATs
Dynamic IPs
No "server" running on the user's machines
Permissions on the user's machine
What happens if the user simply deletes the file on their machine?
To actually make it work you'd have to:
Convince the user to install the app on their machine (you'd need a windows/linux/... EXE)
Get the user to open a port in the firewall (or use some library to enable NAT passthru)
Have the user's PC ping your server in the event the user's IP changes
On the server side, you'd have to keep several database tables, here are few I can think of off the top of my head:
A user's table (user ID [PK], Current IP, Communications Port, (maybe some other tracking things))
Available downloads table (download ID [PK], user ID [FK])
Then when someone wants to go off and download, you have to (probably) launch your app with the requisite arguments (remote user's IP/port/file ID) and have that do the work of the download.
This is by no means an easy feat.
If by WebSockets you mean the HTML5 variety, I'd stay away from that. http://en.wikipedia.org/wiki/WebSockets#Browser_support
The the computer that has to stay on, is basically your server. Even if it isn't a big server somewhere.
My suggestion would be to install apache or some other small web server on each users computer and have have a dyndns address for each computer so you can find each other. it would be much easier than coding something. especially if it has to be through a web page.
You could use a c# client library to interface to bittorrent or etc and use this mode to upload/leach. As far as NAT/Firewall issues go they are well documented and a function of the protocol being used, ie deal with it.

Categories