httpListener in local network without admin rights - vb.net

I have the task to create a listener to a local computer inside a network. This computer takes POST from a web application and prints some stuff.
What I have done until now is to create an httpListener in a specific port and when the POST is received I send things to printer. That's works fine but only when the user has admin rights because the "netsh http..." needs admin rights to be executed.
Is there a way to bypass this restrictions somehow, because the computer is a simple pc and it couldn't has admin rights?
The app is written in VB.NET and will be run in a windows10 PC in a WindowsServer network.

netsh http add urlacl url="http://127.0.0.1:1234/" user=DOMAIN\USER
From what I've read, the backslash is important (trailing the port number). You could also replace 127.0.0.1 with + or * (being wildcards). Oddly enough, I had localhost listening on two different ports, and once I added one both were allowed to listen. It also seems possible to specify a group for user parameter. (In most examples, they demonstrate user=Everyone which I definitely wouldn't advise, if you can help it. Lock it down to a single account, acting like a service account.)
In my case, I'm using Grapevine. It wraps HttpListener, but giving you an example of that wouldn't be too relevant. (I'd highly recommend checking it out, especially if you're creating an API. It's been updated for years, and the developer is still responsive to feedback, and would save you a ton of work.) Just be mindful to mirror the prefix string you use for HttpListener in the netsh command. (Listening via wildcard is definitely different than localhost, and vice versa.)
https://serverfault.com/questions/273875/can-we-use-wildcards-with-netsh-http-add-urlacl-in-windows-7-2008r2
https://github.com/sukona/Grapevine
https://msdn.microsoft.com/en-us/library/windows/desktop/cc307223(v=vs.85).aspx
I'd check out the MSDN link for other parameters. It seems you may be able to lock down the ACL command even further.
(I also have no idea why you were down voted. Your question was perfectly fine, and I found it as one of the top results, as I had the same question.)

Related

Unable to connect to phpMyAdmin via SSh tunnel on Bitnami LAMP stack

I've tried searching for a solution to my problem both here and elsewhere online but I've come up empty, so I'm hoping someone can help. I must initially point out this issue has shown that this area is a complete blind spot for me, so I'm sorry if I'm missing something blatantly obvious, or I'm not explaining thoroughly enough.
I'm trying to access phpMyAdmin on a Bitnami LAMP stack via SSH tunnel, as per guide here: https://docs.bitnami.com/virtual-machine/components/phpmyadmin/. I seem to be able to establish the SSH tunnel, and everything looks correct in the PuTTY event log in terms of opening connection for forwarding, etc, but when I try to navigate to http://127.0.0.1:8888/phpmyadmin in a browser as stated in the guide, I am returned the error 'This site can’t be reached. 127.0.0.1 refused to connect.' After I receive this error I check the PuTTY event log and it shows 'forwarded port closed'. Is anyone able to provide me with some troubleshooting steps I can go through or possible solutions for what the problem may be please? Again, if I've not provided enough information please ask and I'll do my best to update what I can.
For background, I am the nearest thing to an IT lead for a GP and this LAMP stack is used for an online system accessed by both patients and staff for a specific health condition. It was independently created by a GP who has since left the practice, but before doing so he imparted onto me what we thought to be enough information/instruction to keep the system "ticking over" until we found a developer to produce a new one (I'm struggling to get in touch with said GP, so currently asking for their help isn't an option). It is a Bitnami LAMP stack created in Microsoft Azure, and has recently developed a SMTP authentication error whenever a patient/staff member needs to request a new or reset an existing password. I am attempting to access phpMyAdmin to check/reconfigure the SMTP server settings in the hopes of rectifying the situation. I do have some systems experience, previously working as a System Analyst/Technician for a hospital, but as I previously stated this area (servers, etc.) are a bit of a blind spot.
Many thanks to anyone willing and able to help.
Bitnami Engineer here,
It seems that the SSH tunnel was not properly created and that's why you can't access phpMyAdmin now. You can try to reconfigure the port forwarding configuration again or you can edit the Apache's configuration to allow remote requests from your IP to the phpMyAdmin application. To do so:
Edit the /opt/bitnami/conf/bitnami/phpmyadmin.conf file and substitute the Require local line with Require ip YOUR_PUBLIC_IP.
If you do not know your public IP, you can access http://myip.bitnami.com to get that information
Restart Apache and access phpMyAdmin using http://MACHINE_IP_ADDRESS/phpmyadmin

SSL Proxy / Decryption?

One of my clients just received the software ordered from his chosen developers, asked me to look at it and prepare the hosting procedures.
It's an Java (jar) app, so far so good ... but I saw something suspect, every 60 minutes or so the software connects to a remote host :443 port using SSL and transferring ~ 3-10 MB of encrypted data (as POST) then closes the connection, this is very strange. Tried to wireshark it but everything is encrypted and I have no clue about what kind of data is transferred, I know only the destination hostname. The hosted data within the app will be highly sensitive (insurance-broker) and if my client decides to go with it - this is a serious issue for his business and also for his clients, I've asked the developer company about this and they said that no one added something like this even if I provided them the proff (pcap).
I can block it within firewall, but if they added something like this it could exist another hosts ready to receive the encrypted data.
The only way I can figure it out is to somehow decrypt the SSL traffic in order to read RAW data and give my client all the needed informations in order to talk with the developer company to sort it out, how can I do that ? With some sort of ssl-proxy or whatever ... tried to google it but didn't find any kind of relevant tutorials.
I have access to the physical machine which is running the Java application, I can see every single bit of the traffic but ... encrypted.
If I was in your place instead of trying to decrypt ssl connection would have tried following steps:
1)Since you are aware of the host to which it is making a post request , find out more about that service so as to learn what it does ? May be try contacting that site saying that we need to consume your service what should I send my in post request ;)
2)Second way around would be if you can decompile the jar file and find line in the source code which makes that request and then you could go back to the developer asking as why this has been written. To find the source code which is making the call what you could do is block the host access on your firewall.
The code would fail and mostly probably he would have logged the exception in his log files. Find the stack trace and you will know the line of code that is
making that request.
Hope this helps.

Can only access computer IP 192.168.1.3 sometimes (localhost always works)

I have a problem, and maybe I don’t know what do search for, but I haven’t been able to find any threads with a similar problem. So I hope that any of you can point me in the right direction or suggest a solution.
I have a wampserver running on localhost, and I have created a database and a webpage that is using this. When I enter localhost/myproject in the browser the project is displayed. I need to access this site from another device on the same network though, and for that reason I need to use the IP Address of the computer hosting the server (this is 192.168.1.3).
The problem is, that the computer IP is only accessible sometimes. Meaning – if I enter 192.168.1.3/myproject in the browser window, sometimes it will display the webpage as it should while other times it won’t. It either gives me a message of something like “runtime out” or it just keeps trying but never does anything. I can always get access to the router using the IP 192.168.1.1, and here I see the computer 192.168.1.3 even when I can't connect to it.
A while ago I changed the Apache file httpd.conf and added “Allow from 192.168.1.3” under Directory. I did this because I got a message of “access denied” when entering the IP in the browser, and I found a thread posting this solution – which worked. I also created an exception for port 80 in the windows firewall in this process.
I don’t know what to do now though. Any help/suggestions would be very much appreciated, thanks.
Try to increase timeout intervals in your php.ini file
If sometimes it's works, and sometimes - no, problem in timeout

Web-page redirection

I am trying to achieve the following:
when a user types "print" (or "http://print") in the address-bar of the browser :
I want the user to be re-directed to a page : www.abc.com/print/
How can one achieve this ? I tried to lookup some squid configurations but was unable to find the same.
Thanks!
Edit : I do not understand the deal with down votes, this is a perfectly valid question.
If you want to enable a user on your LAN to type "print" in the address bar and be redirected to a given hostname, you'll have to supply a DNS record to that effect. This is not accomplished on a web server, nor is it web development in any respect.
There are several methods to resolving a given hostname to a given IP or to another hostname. One way is to edit the client hosts file, as described in another answer. One could also, if you have a DNS server running within your LAN environment, add A records to this effect.
You must understand how hostname lookups work from a browser. When you type something in the address bar, your browser uses your operating system to resolve the hostname to an IP address. Your operating system uses its hosts file, internet connection, and other mechanisms to accomplish this. This process itself has several tiers and steps that are outside the scope of the browser and which cannot be influenced by the browser. Nor will arbitrary web servers be consulted in this process. Your aim is to inject something in this process that resolves the hostname "print" to the webserver of your choosing - THEN web development might come in to play.
See: http://www.quackit.com/how-websites-work/how-dns-works.cfm

telnet to different IPs and run commands

I'm not sure if this is possible or not.
What I'm looking for is a way to tell telnet to use a certain IP address to log into and then run commands where the commands change based on a user's MAC address.
Basically it would be:
tell telnet to use x.x.x.x as the IP to log into and put in the correct username and password
tell telnet to run commands (based on the user's MAC address) that can change based on which user stats you want to see, for example: show macaddress
export the output to notepad
close
expect can do this. If you don't have Tcl but Python, try Pexpect.
If you just want to run one command, use ssh (which allows you to log in, run a command and which will return with the error code of the command, so you can handle errors, too).
If you want to run more than a single command, write a script, use scp to copy that script to the other side and then execute the script with ssh. I've used this approach with great success to build a simple spider that could run a script to gather system information over a large number of hosts.
I think you're looking for expect (it automates these kind of interactive applications). Here is a gratis chapter from the authority on expect, the book "Exploring Expect".
Also you should use SSH if this is over the internet. Telnet is insecure as it's a plain text protocol.
Not to blow my own horn, but you may be able to twist a personal app of mine (note: Sorry, I've removed this.) to this end.
There's currently no documentation other than what is on that page and no public source code (though I've been meaning to get onto that, and will work that out tomorrow if you're interested), but I'd be happy to answer any questions.
That said, any MUD client could be turned to the same use too.