I am completely new to Ubunut and Linux so I really have no clue what I am doing wrong here. I'm copying this code out of a book I am using to learn penetration testing with python for a college course, but the code is not working. Below I have the code as I am entering it into terminal, followed by the response that it elicits. What is wrong with the code that I am entering?
programmer:~# wget http://zael.org/norman/python/python-nmap/python-nmap-0.3.2.tar.gz-On map.tar.gz
Resolving xael.org (xael.org)... 213.152.29.60
Connecting to xael.org (xael.org)|213.152.29.60|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2014-01-21 16:10:51 ERROR 404: Not Found.
--2014-01-21 16:10:51-- http://nmap.tar.gz/
Resolving nmap.tar.gz (nmap.tar.gz)... failed: Name or service not known.
wget: unable to resolve host address `nmap.tar.gz'
It because you missed a white space between link and the -O option , try:
wget http://xael.org/norman/python/python-nmap/python-nmap-0.3.2.tar.gz
you could also use pip to install package
pip install python-nmap
Related
Good day all,
I tried to install the plotly package on my new work laptop (Windows 10) with the following code:
conda install -c plotly plotly
and I encountered the following error:
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/plotly/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https://conda.anaconda.org/plotly/win-64'
I have tried the following:
Installing the package using my home wifi instead of the company's
Executing conda config --set ssl_verify no
Executing conda config --set ssl_verify false
Copying the 2 files (libcrypto-1_1-x64.dll, libssl-1_1-x64.dll) from Anaconda3\Library\bin to Anaconda3\DLLs.
Interestingly, I was unable to find current_repodata.json file in https://repo.anaconda.com/pkgs/main/win-64/.
Does anyone know how do I create this current_repodata.json file?
Thank you!
I faced similar problems and tried the above options to my dismay.
But somewhere on the internet I had read an answer about using VPN and try different servers and then install using conda.
This seems to work for me now.
Thanks.
Are you in a corporate network behind a proxy?
This issue looks to me like you don't have connection to the internet and your proxy is blocking the connection to https://conda.anaconda.org/plotly/win-64/current_repodata.json
Please try this guide to use conda behind a proxy:
https://docs.anaconda.com/anaconda/user-guide/tasks/proxy/
I am getting this error:
An error occurred initializing the application server: Failed to locate pgAdmin4.py, terminating server thread.
As it fails it will prompt to adjust the python and application path but I read an answer on Stack Overflow where the person said he deleted the path it worked for him and did so but it still gave me the same error and I don't see the prompt again.
So I went to pgAdmin official site only to see that if it fails I must enter python and application path. How can I configure the paths for the pgAmin. I am using Fedora 27.
Try to just delete the config file. You may have an old one from a previous install.
rm ~/.config/pgadmin/pgadmin4.conf
As it fails it will prompt to adjust the python and application path but read an answer on stackoverflow where the person said he deleted the path it worked for him and did so but it still gave me the same error and i don't see the prompt again
Probably your first error was actually
An error occurred initialising the application server:
Failed to launch the application server, server thread exiting.
Most likely you missing some dep like python3-flask-babelex
e.g on fedora install
sudo dnf install python3-flask-babelex
You see following error (one you mentioned) when you have misconfigured user config file. Which was created after you edited default values from prompt
An error occurred initializing the application server:
Failed to locate pgAdmin4.py, terminating server thread.
This error can be solved by either fixing your config or deleting it to use default values:
e.g. on Fedora checking that your user config is correct
vi ~/.config/pgadmin/pgadmin4.conf
Primarily check that path variables in [General] section are ok.
# example
[General]
ApplicationPath=/usr/lib/python3.6/site-packages/pgadmin4-web/
PythonPath=/usr/lib/python3.6/site-packages:/usr/lib64/python3.6/site-packages
For me, the solution was to sudo dnf remove pgadmin4* then sudo find / -iname "*pgadmin4*" and delete any scraps lying around, then sudo dnf install pgadmin4* - everything is now working fine.
I'm trying to route requests in a python script through tor.
Here's the code:
#!/usr/bin/env python3
import socket
import socks
from urllib import request
socks.set_default_proxy(socks.SOCKS5, '127.0.0.1', 9050)
socket.socket = socks.socksocket
ip = request.urlopen('https://api.ipify.org/').read()
print(ip)
When I try to run it as a user (just "./script.py"), it crashes with the following error:
urllib.error.URLError: <urlopen error Socket error: 0x01: General SOCKS server failure>
But if I run the script with sudo ("sudo ./script.py"), it works as expected and prints a tor IP. How can I get it to work without sudo?
Edit 1: I think tor installation is ok, because it works fine with other languages (for example, I can perform requests from a Go script. Also, I can get my python script to work with tor when passing proxies dict to requests.get() (as suggested in a comment below). This solution is acceptable, but I am still wondering, what's wrong with my script.
Edit 2: I'm running Linux Mint 18.3 64-bit. Python and Python3 are pre-installed. Tor was installed via repository (sudo apt-get install tor). I tried installing PySocks globally (sudo pip3 install PySocks) and only for current user (pip3 install --user PySocks).
Did you try looking at : https://tor.stackexchange.com/questions/7101/general-socks-server-failure-while-using-tor-proxy? This seems to be what you are looking for, and they indicate this can be resolved using an intermediate connection on 127.0.0.2. Take a look!
I have tried your code on my machine (after installing the right packages) and it works as it should. Something should be wrong with the way Tor is installed/run in your system. Feel free to add details about your installation to your question and I'll try to take a look at it.
I'm using Windows 10 pro(x64) and I have just installed Anaonda 4.3.1
But whenever I try to install a package or update conda, it shows an error like the below.
(d:\Miniconda3) C:\Windows\system32>conda update conda
Fetching package metadata .....
CondaHTTPError: HTTP None None for url <None>
Elapsed: None
An HTTP error occurred when trying to retrieve this URL.
SSLError(SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_read_bytes', 'sslv3 alert bad record mac')],)",),),)
conda config --set ssl_verify False doesn't make any difference either.
I have no problem installing packages using pip.
These errors coming from such abstracting (i.e. with a high level of abstraction) tools are usually really hard to debug from the tool themselves (it requires quite a lot of digging around in the tool's code to pinpoint and finally find the issue); to the extent that in the vast majority of cases, once you've debugged it, you know enough about the tool in question to actually be able to write a patch to solve that problem.
What I would recommend is to first trace how does conda get the metadata it is getting at first (first line of your output). On UNIX I would recommend tcpdump, but on windows I would use wireshark (albeit according to the wikipedia page for tcpdump, it works on windows too).
Once you know what host the package should be obtained from, you can try to understand why it occurs. Namely, the bad record mac error should not occur under normal conditions; i.e. either you have a network problem (try with another network) or there is a server (more likely if conda used to work) or client problem.
To try to debug the SSL issue once you know the host, run:
openssl s_client -connect $host:443 -msg -debug
Where $host is the host you found using tcpdump/wireshark.
Best of luck!
Note: I have not linked wireshark.org in this answer, but instead the wikipedia page for wireshark to prevent supporting bogus security practices 1,2. Please do not edit that link.
I know how to use requests very well, yet for some reason I am not succeeding in getting the proxies working. I am making the following request:
r = requests.get('http://whatismyip.com', proxies={'http': 'http://148.236.5.92:8080'})
I get the following:
requests.exceptions.ConnectionError: [Errno 10060] A connection attempt failed b
ecause the connected party did not properly respond after a period of time, or e
stablished connection failed because connected host has failed to respond
Yet, I know the proxy works, because using node:
request.get({uri: 'http://www.whatismyip.com', proxy: 'http://148.236.5.92:8080'},
function (err, response, body) {var $ = cheerio.load(body); console.log($('#greenip').text());});
I get the following (correct) response:
148.236.5.92
Furthermore, when I try the requests request at all differently (say, without writing http:// in front of the proxy), it just allows the request to go through normally without going through a proxy or returning an error.
What am I doing wrong in Python?
It's a known issue: https://github.com/kennethreitz/requests/issues/1074
I'm not sure exactly why it's taking so long to fix though. To answer your question though, you're doing nothing wrong.
As sigmavirus24 says, this is a known issue, which has been fixed, but hasn't yet been packaged up into a new version and pushed to PyPI.
So, if you need this in a hurry, you can upgrade from the git repo's master.
If you're using pip, this is simple. Instead of this:
pip install -U requests
Do this:
pip install -U git+https://github.com/kennethreitz/requests
If you're not using pip, you'll probably have to explicitly git clone the repo, then easy_install . or python setup.py or whatever from your local copy.