wget trouble, explicit encryption - ftp

I cant access server with explicit encryption.
Example:
wget --secure-protocol=SSLv3 --no-proxy --passive-ftp
ftp://username:password#host:port/folder/file.pdf
Response:
Logging in as username ...
The server refuses login.
Retrying.
Can somebody help me with it? Thanks in advance.

try the alternate parameter syntax
--ftp-user and --ftp-password so therefore:
wget --secure-protocol=SSLv3 --no-proxy --passive-ftp --ftp-user=username --ftp-password=password ftp://host:port/folder/file.pdf

Related

Use Ncat in Heroku for Proxy Authentication

I need to use a proxy over ssh connection and I need the ncat tool.
But I cannot find any articles how can I setup nmap-ncat and use it.
Thanks for any help.
I could do it using https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-apt
in Aptfile just add nmap

Creating a keytab on Windows for Kerberos authentication on Linux

I need to run curl commands from a Windows server to an API on a Linux box. When I am on my workstation I just run a kinit and give my user name and pwd for the Kerberos realm.
I have automated scripts in which I need to run a kinit before running the Powershell script. I do not want any manual intervention. I am trying to create a keytab file with my Kerberos account but it is not working -
I am receiving the error message "No key table entry found for user#domain.net while getting initial credentials.
I really don't understand much about Kerberos, and whether the process cares that I am on a Windows server tryng to use a keytab file for this purpose.
Can someone help? I have been going a bit nuts with this...
Thanks for any help!
Look into your keytab if the principal there is the one you are going to use. klist -k -t <keytab>
You are obviously doing wrong. You have to obtain a curl binary for Windows which says with curl --version:
curl 7.46.0 ...
Protocols: http https ...
Features: SSPI Kerberos SPNEGO ...
That's it. Enable SPNEGO auth with curl --negotiate -u : <URL> and you are done. No keytab necessary on Windows.

Download with aria2 from a server with authentication

I have a file on a server under my account and I need to download it. Let us say that the url is http://my.server/files/myfile. I need to authenticate with username and password. I can do that with wget as follows
wget http://username:password#my.server/files/myfile
and it works. However, trying the same thing with aria2
aria2c http://username:password#my.server/files/myfile
fails with error message
-> [HttpSkipResponseCommand.cc:211] errorCode=24 Authorization failed.
Is there a way to fix this? I have also tried --http-user and --http-passwd options with no luck.

Get windows proxy username/password

I have an access to a preconfigured Windows XP 32-bit workstation.
It's under firewall and to get outside it uses http proxy server.
To get proxy settings I need host, port, username and password.
http: // username : password # server : port
I'm able to find the proxy url and port (from PAC - automatic config file),
but I don't know how to get username/password. Is there a way to read it somehow? At least username? I might get the admin rights.
Do you know any tool that can help?
I only found these MS docs about some methods to get proxy config connection, but I don't know how to determinate what's the provided credentials:
WinHttpGetIEProxyConfigForCurrentUser function
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG structure
WinHttpGetProxyForUrl function
I've also found this lib, but it's rather for parsing PAC:
http://code.google.com/p/pacparser/
In windows you cannot get password.
To get connect throw a proxy you have to use SSPI, check libcurl, you can get a connected socket throw proxy, build it with enable-sspi and openssl.
Iterating on Fernando Sanchez's answer and Robert's comment, you need to authenticate via SSPI. In my case I've connected using NTLM using this link
With curl using ntlm :
curl.exe --proxy <proxy_name>:<proxy_port> --proxy-ntlm -U : https://www.google.com
Also to partially answer your question the -U : means from curl man page :
If you use a Windows SSPI-enabled curl binary and do either Negotiate
or NTLM authentication then you can tell curl to select the user name
and password from your environment by specifying a single colon with
this option: "-U :".
You can get the proxy name and port from the windows registry (regedit). Quote from Robert's comment:
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings]
It can be present either in a manual way using REG_SZ ProxyServer or using an autoconfiguration script using REG_SZ AutoConfigURL = https://<configuration_url>
If the curl command above fails with Failure when receiving data from the peer maybe you have a curl release without NTLM, SSPI or OpenSSL. Try with the latest curl release

How can you download a file/zip from the commandline using putty?

I'm trying to write a batch script (CMD # Windows XP Pro) that will automatically download and unzip packages with the help of 7zip and putty/psftp
If I have a URL to a package to download http://somesite.org/packages/package.zip how do I download it on command line using putty?
Also if you have a better way to do this that would be helpful too.
wget is of course an obvious solution, but I also suggest to have a look at cURL. From their website:
curl is a command line tool for
transferring files with URL syntax,
supporting FTP, FTPS, HTTP, HTTPS,
SCP, SFTP, TFTP, TELNET, DICT, LDAP,
LDAPS and FILE. curl supports SSL
certificates, HTTP POST, HTTP PUT, FTP
uploading, HTTP form based upload,
proxies, cookies, user+password
authentication (Basic, Digest, NTLM,
Negotiate, kerberos...), file transfer
resume, proxy tunneling and a busload
of other useful tricks.
Of course free and open source, and despite its huge list of supported protocols it's as simple to use as wget, so to use your example
curl -O http://somesite.org/packages/package.zip
downloads package.zip to a local file with the same name
curl -o myname.zip http://somesite.org/packages/package.zip
downloads package.zip as myname.zip
curl http://somesite.org/packages/package.zip > package.zip
redirects curl's stdout to package.zip
EDIT - example corrected, with thanks to #PrabhakarKasi
win32 version of wget:
http://pages.interlog.com/~tcharron/wgetwin.html
Putty isn't really a download tool. Unless you want to download something via SCP/SFTP. So yes, wget is more helpful here.
I don't know putty, but certainly wget can do. If you are in Windows, you can get it by cygwin or just google a win32 version.
pscp.exe -pw yourpassword you#somesite.org:/packages/package.zip .\
The path to /packages/package.zip should be whatever the path to the public web files are on the server. So, for example, on some old apache server, it might be:
pscp.exe -pw yourpassword you#somesite.org:/users/httpd/vhosts/default/packages/package.zip .\
Use pscp, which comes with PuTTY:
pscp user#host:/path/to/file.7z .
7z e file.7z
If you set this up with SSH keys, pscp won't have to ask you for a password.

Resources