?
Solved

FTP Trashes My File!

Posted on 2004-11-10
6
Medium Priority
?
231 Views
Last Modified: 2013-12-25
Hi,

I'm having a weird problem with a CGI script I'm trying to run on an Apache server.  The script runs fine on the server, but whatever I've tried doing to pull the file down trashes it completely.  The file is full of the source code which is surrounded by gibberish, mostly the symbols "^@".

Now before you give me the newbie answers, think about why this is a 200 point question.  I've been in web development for almost 10 years.  Yes, I'm downloading the file as ASCII.  I've pulled via ftp, sftp and I've ssh'd into the system and pushed it, and it still happens.  Thinking it was a Windows thing, I've tried keeping the entire file in a UNIX environment (well...OS X Unix, anyway) and nothing seems to work.  I can't pull it down without this corruption occurring.  

Can anyone think of something I might be missing?

Thanks,

Raydot.
0
Comment
Question by:Raydot
6 Comments
 
LVL 5

Expert Comment

by:mrielf
ID: 12551890
Cat file to display and check it isn't corrupted at all.
Try to pack file with gzip and get it with ftp as binary file.


0
 
LVL 48

Accepted Solution

by:
Tintin earned 800 total points
ID: 12560600
On the server, try doing

od -c scriptname

This will show you if you have any unusual characters that you wouldn't normally see.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 12574613
^@  do mean that these are binry zeros?
please check with od (as already suggested)
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 3

Author Comment

by:Raydot
ID: 12578467
Sorry, I can't check from home so y'all wont hear back from me until I return to work Monday....
0
 
LVL 3

Author Comment

by:Raydot
ID: 12578495
Oh wait, actually, two questions.  I actually did look at the file on the server and it looked exactly the same, so it's not something going on in transfer.  This leaves me to wonder how this thing can even run!  I unfortunately can't get a hold of the original developer since he's kind of an odd duck.

1)  Is it possible (although it seems unlikely) that I'm dealing with a compiled file?
2)  "od" is something I didn't think to do so thanks for that tip...is there a difference between "od" and "hexdump?"
0
 
LVL 3

Author Comment

by:Raydot
ID: 12579229
Good call Tintin, you helped me answer my own question.

Once I od'd it I could see that the file is a compiled C file.  So, of course, I'll need the source code to make any modifications.  It was an easy thing to miss considering the fact that the bulk of the .cgi file comes up as HTML.

Thanks for the help, everyone...
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month14 days, 21 hours left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question