Why smtp.gmail.com returns Unrecognized command? - winapi

I've written a winsock client
that connects with smtp.gmail, but after the first
EHLO command, every other command would return Unrecognized
command. I tryed AUTH, AUTH LOGIN, MAIL...but all
return the same thing. Where do I find the commands
that works with this server, I think they use SMTP commands differently

They appear to be using an RFC 3207 SMTP/TLS server. Check here for more information: RFC 3207.

Related

Why FreeSwitch api command does not work in CLI?

From this guide, I know that FreeSwitch (FS) will load modules, each module would provides some commands and all these commands can be accessed from FS_CLI or ESL.
Here is my test:
1/ Show available commands from FS_CLI:
freeswitch#my-pc> show api
name,description,syntax,ikey
...,Shutdown,,mod_commands
acl,Compare an ip to an acl list,<ip> <list_name>,mod_commands
alias,Alias,[add|stickyadd] <alias> <command> | del [<alias>|*],mod_commands
banner,Return the system banner,,mod_commands
bg_system,Execute a system command in the background,<command>,mod_commands
bgapi,Execute an api command in a thread,<command>[ <arg>],mod_commands
.... other commands....
And I don't see api command from above list.
2/ Try to run api command from Inbound socket connection:
➜ ~ telnet localhost 8021
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Content-Type: auth/request
auth ClueCon
Content-Type: command/reply
Reply-Text: +OK accepted
api msleep 2000
Content-Type: api/response
Content-Length: 3
+OK
3/ Try to run api command from FS_CLI:
freeswitch#my-pc> api msleep 2000
-ERR api msleep 2000 Command not found!
Pls, help me to explain why #2 worked but not #3 (afaik FS_CLI utilizes socket under the hood)
Try to remove api in the command it should work.
freeswitch#ip-172-31-33-109> msleep 2000
+OK
You need to add api when try to call a command outside of CLI in CLI no need to add api without it's work.

Azure FTP login via command line / batch file fails

I am trying to connect by FTP to an Azure Web App. I downloaded the publish profile and copied the login to my FTP client and can connect successfully. But when i use ftp.exe from Windows then i am not able to connect to the same host with the same credentials.
I have read Connecting to Azure website via FTP but those solutions do not fix my problem.
This is the output:
C:\Projects>ftp
ftp> open waws-prod-am2-201.ftp.azurewebsites.windows.net
Connected to waws-prod-am2-201.drip.azurewebsites.windows.net.
220 Microsoft FTP
Service 200 OPTS UTF8 command successful - UTF8 encoding now ON.
User (waws-prod-am2-201.drip.azurewebsites.windows.net:(none)): firstserver\$firstserver
331 Password required
Password:
530 User cannot log in.
Login failed.
Invalid command.
Also tried with username firstserver from the Windows command prompt, no difference. Do not forget: when logging in via commercial FTP client software I CAN login successfully.
I tried backslashing the backslash and/or the dollar sign, but nothing helps. What is going wrong, how do i login from the command prompt using the Windows default ftp.exe?
If you run ftp in debug mode (-d switch), you will see that it truncates the password to 32 characters. That's why the connection fails.
Try using a shorter password. Otherwise you will have to use another command-line FTP client.

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

Ruby NET::FTP Not Resolving Correct IP

I am trying to connect to an FTP server using:
ftp = Net::FTPFXPTLS.new
ftp.passive=true
ftp.debug_mode=true
ftp.connect('200.111.111.11',21)
ftp.login('Username','Pass')
ftp.chdir('inbound')
ftp.putbinaryfile("./#{filename}", "/#{filename}")
ftp.close()
For the purposes of this example 200.111.111.11 is the correct IP and 10.1.1.1 is the fake IP.
When I connect via an FTP client such as Transmit I connect fine and everything works as normal but in the transcript it states:
Cmd: PASV
227: Entering Passive Mode (10,1,1,1,47,79).
Fixing bogus PASV data address from 10.1.1.1:12111 to 200.111.111.11:12111.
Then when it tries to connect via the ruby script:
get: 425 Failed to establish connection.
When it tries to do any action like LIST or STOR because the PASV command always returns 10.1.1.1:12111.
So is there anyway to ensure the PASV command uses 200.111.111.11 and not what is sent back to it?
This seems to be more of an issue with the gem, there is a solution for it but woud take a little while to implement. In order to save time we simply switched the protocol to use SFTP which works flawlessly. (Switched both server and code)

How to upload a file from PC to AS400 machine using FTP Command

Need a Help about FTP command PUT.
Requirement is to upload a file from Windows PC to AS400 machine. Here is the command (running as a batch file) I am using:
open ipAddress
Kishore //user
pwd //password
quote RCMD CRTLIB LIB(TESTXA) TEXT('TESTXA Java Application Source') //Successfully creates TESTXA library
quote RCMD CRTSRCPF FILE(TESTXA/QJAVASRC) RCDLEN(200) TEXT('Java Source File') //Successfully creates source file QJAVASRC under TESTXA library
put "D:\Shared\JavaTest\ClobTest.java" /QSYS.LIB/TESTXA.LIB/QJAVASRC.FILE/CLOBTEST.MBR // Generating error 'ftp: bind : can't assign requested '
quote RCMD CHGPFM FILE(TESTXA/QJAVASRC) MBR(CLOBTEST) SRCTYPE(JAVA) TEXT('ClobTest') // Not executing due to previous command error
bye
Please suggest what am doing wrong with PUT command??
Thanks in advance
Smells like a firewall. Before doing the PUT, try setting passive mode. quote pasv
Specify namefmt 0 before put. Namefmt 0 tells ftp to use library/object naming.
Check the client proxy settings.
Bind: Can't Assign Requested Address from Ftp.exe Using Winsock Proxy
If the IP address of an external interface on the Proxy Server is in the LAT, it is considered by the proxy client to be internal. Because the client computer does not have an interface with the same IP address as the external IP address of the Proxy Server, you get the above error message.

Resources