Archive for February, 2009
Alternative ways to transfer files when you do not have ftp or sftp server available
Very often I find myself having to transfer files to remote machines that do not have ftp or sftp server running.
Here are a few methods that I use in those cases:
- Using scp:
The secure copy protocol and command are part of ssh. I am assuming that you have Linux or Unix boxes that you are dealing with. If any of them are Windows computers you need to install ssh servers and clients respectively.
The command looks like this:scp source_file user@IP:pathFor example, if I wanted to copy the 1.txt file to the /tmp directory on the remote computer with ip address of 24.155.21.105 as root, I would do:
scp 1.txt root@24.155.21.105:/tmp/ - Using ssh:
cat source_file | ssh user@IP -c ‘cd /target_dir ; cat > target_file’For example if I wanted to transfer my local file 1.txt to the same remote host and save it in the /tmp directory under the name of 2.txt, I would do:
cat 1.txt | ssh root@24.155.21.105 -c ‘cd /tmp ; cat > 2.txt’ - Using netcat:
First you need to start a netcat server on your local machine to serve the files:
cat source_file | nc -l port_numberThen on the computer receiving the file you do:
nc IP port_number > target_fileFor example, if I wanted to send the same file 1.txt to the same remote computer and save it as 2.txt over port 3030 (you can chose any port, but make sure it is over 1024), I would do:
On the local computer:
cat 1.txt | nc -l 3030On the remote computer, receive the file by specifying the IP address of the machine sending the file:
nc 122.45.62.10 3030 > 2.txtAgain, note here that the ip address specified is of the computer sending the file (unlike the previous examples with scp and ssh).
Find out the subdomains of a given domain name with dig
First, find out the name server(s) for the domain name in question:
dig wikipedia.com
Look under the “AUTHORITY SECTION”:
;; AUTHORITY SECTION:
wikipedia.com. 163475 IN NS ns2.wikimedia.org.
wikipedia.com. 163475 IN NS ns1.wikimedia.org.
wikipedia.com. 163475 IN NS ns0.wikimedia.org.
In this case wikipedia.com has 3 name servers: ns0.wikimedia.org, ns1.wikimedia.org and ns2.wikimedia.org. Now we can query one of these three servers for the subdomains of wikipedia.com:
dig @ns1.wikimedia.org wikipedia.com axfr
Here is what we get back (the list is rather long, so I have truncated it quite a bit);
; <<>> DiG 9.5.0-P2 <<>> @ns1.wikimedia.org wikipedia.com axfr
; (1 server found)
;; global options: printcmd
wikipedia.com. 3600 IN A 208.80.152.2
wikipedia.com. 86400 IN NS ns0.wikimedia.org.
wikipedia.com. 86400 IN NS ns1.wikimedia.org.
wikipedia.com. 86400 IN NS ns2.wikimedia.org.
wikipedia.com. 3600 IN MX 50 lists.wikimedia.org.
wikipedia.com. 3600 IN MX 10 mchenry.wikimedia.org.
aa.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
aa.mobile.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
aa.wap.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
ab.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
ab.mobile.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
ab.wap.wikipedia.com. 3600 IN CNAME rr.wikimedia.org.
...
...
...
Note: Not all dns servers will allow axfr protocol queiries. Those will return “Transfer failed”.
Search
Recent Comments
- Olivier on Dynamic Port Forwarding with SOCKS over SSH
- Ld7 on How to connect your Android phone to Ubuntu to do development, testing, installations or tethering
- get more Info on How to get Picasa images using the Image Picker on Android devices running any OS version
- Casper on How to detect a user pan/touch/drag on Android Map v2
- Install SSH as socks proxy for dynamic port forwarding | Steve Constine on Dynamic Port Forwarding with SOCKS over SSH
Categories
Blogroll
Online Tools
Other
BLOG ARCHIVE
- April 2013 (1)
- November 2012 (2)
- August 2012 (1)
- May 2012 (1)
- March 2012 (1)
- November 2011 (1)
- August 2011 (1)
- April 2011 (1)
- January 2011 (2)
- September 2010 (1)
- August 2010 (2)
- July 2010 (2)
- June 2010 (2)
- May 2010 (1)
- January 2010 (2)
- December 2009 (2)
- November 2009 (3)
- October 2009 (1)
- September 2009 (3)
- July 2009 (1)
- May 2009 (1)
- March 2009 (1)
- February 2009 (2)
- January 2009 (2)
- December 2008 (1)
- November 2008 (4)
- October 2008 (5)