How do I monitor what commands my ftp application is sending to a ftp server - ftp

F
Is there a way to monitor the FTP port so that I can know what commands my FTP application is sending to a FTP server?
I am using a closed-source FTP client application, which is not working with a closed-source FTP application server. The client and the server are not communicating well with each other, and I would like to find out why. I wish to reverse-engineer the client to see what commends the client are sending to the sever. I used a web test tool before that allowed me to monitor the content transferring through HTTP, but I can't seem to find such tool for FTP. I appreciate it if you can help me out, thanks.

Sounds like you need a packet sniffer - assuming your network admins/company policy allows it...I have used wireshark fairly successfully before.
The core FTP commands should be visible in the packets.

You can use the Wireshark application: http://www.wireshark.org/
It should have decent parsing capabilities for FTP as well as other protocols.

Can you configure a proxy with the client? Then you could install an ftp proxy server using the logging on that to see what's going on?
There's a proxy server for Linux here: http://frox.sourceforge.net/doc/FAQ.html
Paul.

Do you have access to ftp-server logs? Its likely those commands would be logged there.
If they aren't, your next option would be to configure the server to log them, if you have access.
If thats not an option or server does not log such things, then you have to go to either packet sniffer or a proxy, as suggested by previous posters.

On Unix, tcpdump might be your friend. Maybe you should first state which OS you're targeting, though.

If you have the ability (often requiring root access) to use a packet sniffer, tcpflow sniffing the TCP control channel will show you the commands and responses going back and forth in an easy-to-read format.
If you don't have such access, tools such as ktrace and strace will allow you to see all data read and written on the socket for this connection, though it will be a little work to extract it.
If you could tell us just what tool you were using for HTTP traffic, that would allow us to look for something similar for FTP traffic.

Related

Forwarding RDP in tcp tunnel

I am creating a TCP tunnel application for RDP connections, On Server-side: Redirecting RDP connections to tunnel-server, Then sending those data to Client-side which receives the data successfully. But what happens after that? I don't know!
I know it is easier if traffic was HTTP/HTTPS because you can parse the header to address and content then send back the result. You don't even need TCP or sockets but forwarding RDP is unclear for me.
How can i forward those traffics from client-side then sending the results back to server and mstsc (windows default RDP client)? My problem is with the concept, Should i send those RDP data to client then from client machine to port 3389? And this app is considered some sort of Socks Proxy i guess.
This is the structure of what i have done at the moment:
Similar threads that aren't answer to my issue:
RDP through TCP Proxy
How to create a simple proxy in C#?
C# Proxy using Sockets, how should I do this?
P.S. The type of programming language doesn't matter for me (Currently working with c# and python but newer languages are OK too), I just want to learn how it works conceptually with a simple pseudo-code or sample, All kind of explanations or examples are appreciated.

p2p direct data exchange...via HTTPS?

Is there any protocol, API or software in existence that can send data/IM/etc directly from one device to another with no server?
Can you not use HTTP GET/POST/DELETE directly between two devices when their device data is known to the user(s)?
I would very much like to know if there is ANY software/protocols that can do this.
thank you!
The internet is build on the Internet Protocol suite. This suite has 5 different layers of protocols: The physical layer, the link layer, the network layer, the transport layer and the application layer. Each depends on the one before.
If you just use the browser, by default HTTP (application layer) is used, which relies on TCP (transport layer), which relies on IP (v4 or v6, network layer), which relies on ethernet (link layer), which finally relies on the actual cable that's plugged into your computer (for WiFi, the first three are the same but the last two differ if I'm not mistaken).
Now to your question: Is there any protocol, API or software in existence that can send data/IM/etc directly from one device to another with no server?
Yes there is. I suggest you start looking at protocols that are in the application layer. To highlight a few standards next to HTTP(S): FTP is for file transfer, IMAP is for emails clients, SMTP is for email servers and SSH is a secure shell which can also be used to tunnel data through.
For your specific case, I think either FTP (FTPS if you want it over SSL), or SSH can be a solution, but it's hard to know for sure without the specifics.
The only thing that these protocols have in common is that one of the two computers will act like server and the other computer as client. This has as downside that port-forwarding might be necessary.
If you've chosen the protocol you'd like to use, then you're up for the next step, selecting a program that can do that for you. For HTTP(S), I'd recommend Apache. If you're using Linux and chose SSH, then you're in luck, there is a build in SSH server in Linux, you can use that. For other protocols, you might just want to search yourself, as I do not have any suggestions.
I hope this answers most of your questions!
Desirius
In browser context, WebRTC is probably what you are looking for: It allows user to user communications.
https://en.wikipedia.org/wiki/WebRTC
https://webrtc.org/

My windows FTP server unable to access remotely on some networks

I have setup a windows 2003 ftp server and using chilkat to connect to this ftp inside my customized application. My application is developed in VB6 with ftp support of chilkat. The application works on different places of the city and connects to my ftp. Unable to access ftp and transfer files using the customised application, from some networks like idea netsetter / bsnl. It works perfect on other networks.
Thanks in advance.
Regards,
Sam
This is likely to be a firewall issue at the client end. FTP is often blocked by firewalls.
Just as well, FTP has its problems making it a less than ideal alternative. There are better options such as SFTP or FTPS but support for those is limited in Windows and you'll have to buy both server and client pieces to use one of them.
Fewer firewalls block HTTP and HTTPS though some are finicky enough to block traffic that doesn't look like Web browsing. Stiil, your odds of success go up substantially.
An obvious choice might be to use WebDAV. IIS supports WebDAV and it is pretty easy to write simple WebDAV client logic in VB6 based on one of the many HTTP components available. I'd probably use XmlHttpRequest or WinHttpRequest for that. A search ought to turn up several VB6 classes written to wrap one of them to support WebDAV client operations. You can also buy WebDAV client libraries.
Stick to using HTTPS (which means you need a server cetificate for IIS) and you won't have passwords going over the network in the clear. Even if you use HTTP you'll be no worse off than using FTP, plus it'll work through the vast majority of firewalls except those that specifically block non-browsing HTTP requests.
This could be a firewall configuration on the Client or Server. You're not going to be able to do much about the client, but for the server it may depend on whether your doing Active or Passive FTP connections.
If you are doing Active connections, make sure ports 20 and 21 are open.
If you're doing Passive connections, you may want to check out this article about configuring the PassivePortRange in Server 2003 FTP- http://support.microsoft.com/?id=555022.

Real-time HTTP stream writing console

Is there a program available that will allow me to interactively write HTTP stream data and send it to a server? Ideally I'm looking for a console app that will allow me to type or paste HTTP headers and body, send it to my server, and get the response headers and body back.
Does such a program already exist?
I'm running W7 64-bit with .NET 4.0.
if you change your mind and want a GUI app
http://code.google.com/p/rest-client/
or you can also use fiddler
Edit:
http://code.google.com/p/rest-client/ also supports commandline
Maybe telnet is an option for you? If it's not already installed on your machine, take a look at this guide from MS.
To connect to your server use it like this:
telnet www.myserver.de 80
After the connection is established, you can paste your HTTP GET reqests or what ever you like.
tinyget is a useful MSFT tool that will make simple get requests. You can store these requests in text files and stream them in.

How to Debug/Monitor SMTP Communications?

Debug HTTP is easy, you have all sort of tools to do it (like Fiddler). What about SMTP?
How to Debug SMTP Communications?
My target system is Windows.
Suggested tools:
Ethereal
tcpdump
Microsoft Network Monitor
For the two people who responded with Ethereal: We renamed the project to Wireshark (http://www.wireshark.org) back in 2006 due to trademark issues. I strongly recommend upgrading.
Depending on your exact issue, Wireshark's Follow TCP Stream feature is pretty useful for debugging Internet Message protocols, including SMTP.
How to capture emails with Wireshark:
Get wireshark -> Install
Into filter enter smtp click Apply
When you get filtered lines click right mouse button on one of them and select 'Follow TCP stream'.
You should get window like following
(OPTIONAL) If you want to inspect contents of email that are base64 encoded
Copy part that looks like gibberish into one of base64 to text converters, there are plenty online. You should get readable text that was sent.
Hope this saves you some time.
smtp-cli is good for this. From the homepage:
smtp-cli is a powerful SMTP command line client with a support
for advanced features, such as STARTTLS, SMTP-AUTH, or IPv6
In addition to being a full-featured client, its --verbose option makes it
the tool I think you're looking for to track down SMTP issues (like, for instance,
why a server is rejecting a given to: address, which is how I found the tool :-) )
Again from the homepage:
It's also a convenient tool for testing and debugging SMTP servers' setups.
Even the hardcore mail admins used to typing the SMTP protocol over telnet
need a specialised tool when it comes to verifying encryption settings of
their TLS enabled server with a subsequent user authentication. Such things
are pretty hard to type into a telnet session by hand :-)
Try Ethereal - its a free network protocol analyzer.
The SMTP protocol is all ascii, so once you see whats inside the TCP connection, you should be good to go.
It will take a bit of work learning how to use Ethereal.
You can use a SMTP development server, like Neptune or Antix. Both work the same way: they create a "fake" SMTP server in your machine so you can test your e-mail sending methods, without actually sending the messages they receive.
Use tools like ethereal (www.ethereal.com) or tcpdump (www.tcpdump.org), if you want to see the SMTP traffic.
If you like to check your server for compliance with relaying standards, do a
telnet relay-test.mail-abuse.org
from your SMTP server and it checks your server for relaying vulnerabilities.

Resources