Sponsored Content
Top Forums Shell Programming and Scripting Adding gzip compression to a connection using nc Post 302604022 by haggismn on Friday 2nd of March 2012 02:47:32 PM
Old 03-02-2012
Thanks for your response.

Yes, ssh is a possible solution, however I can't use it in this case.

I should have added more detail. The problem is that I can't use protocols like ssh or even other applications like stunnel for using ssl. The assumption is that the connection the program is being used on is heavily firewalled. In such a case, an http connection may be the only kind that works. The idea is that by using gzip, any data that goes through the http connection will be compressed, and also, the data will be transformed in a way that will allow it to escape detection from things like regex filtering.

Well that is in theory. If I can get this part working, I will then start onto using suricata to perform on-the-fly gzip decompression and regex filtering.

I have a normal tunnel now working correctly, with
Code:
 while true ; do cat /tmp/rev | nc -l 3333 | nc localhost 8080  > /tmp/rev ; done

I just need to figure out where to put the gzip commands. Furthermore, would a similar command be used on the server, or would it need altering?

Thanks again in advance for any help.

Last edited by haggismn; 03-02-2012 at 04:53 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Connection reset by peer..closing connection

Hello I'm facing the above problem while doing a performance run. I've a script which I'm launching from my windows desktop using mozilla. The script will invoke backend action on a Solaris host which in turn feeds the records to a driver located on a linux box(Cent OS). What's happening is... (1 Reply)
Discussion started by: subramanyab
1 Replies

2. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

3. Shell Programming and Scripting

file compression

I'am looking for script (or tool) that would compress all files with given extension in all subdirectory. Important part is that every one file have to end in separate archive whit it's own name. Eaven if I could point multiple file in one directory and compress them it would be ok. I' am... (1 Reply)
Discussion started by: Demerzel
1 Replies

4. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

5. UNIX and Linux Applications

Compression (gzip) for image analysis

Hi Everyone, I am a Ph.D student working on some image processing tasks and I have run into an interesting problem that I thought someone on here might have an idea about. This paper discusses a method to compare two images based upon the amount they can be compressed. Sorry, since this is my... (3 Replies)
Discussion started by: rudigarude
3 Replies

6. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

7. Linux

Best Compression technique ?

Hi all, I am working on a sample backup code, where i read the files per 7200 bytes and send it to server. Before sending to server, i compress each 7200 bytes using zlib compression algorithm using dictionary max length of 1.5 MB . I find zlib is slow. Can anyone recommend me a... (3 Replies)
Discussion started by: selvarajvss
3 Replies

8. Shell Programming and Scripting

Show Percentage Compression in GZIP

Hi, I used gzip command to compress a huge tar file. But I saw that compression % was more than 100%. It might have inflated instead , probably because tar file is already packed properly. So I thought of unzippping it. Now after unzip I expected the tar file to be of less size than... (12 Replies)
Discussion started by: vinay4889
12 Replies

9. UNIX for Advanced & Expert Users

Compression with openssl

Hi , 1-I need to know please if it's possible to compress using openssl? Here is the version used: openssl version -a OpenSSL 0.9.7d 17 Mar 2004 (+ security fixes for: CVE-2005-2969 CVE-2006-2937 CVE-2006-2940 CVE2006-3738 CVE-2006-4339 CVE-2006-4343 CVE-2007-5135 CVE-2008-5077... (3 Replies)
Discussion started by: Eman_in_forum
3 Replies

10. UNIX for Advanced & Expert Users

Tar gzip compression rate

How good is the compression rate of gzip when you use tar with the gzip option? I am pretty amazed that a 1 GB file was reduced to 1019K. This is what I did. tar -cvf tar_test.tar.gz -T /list_of_files ls -hl -rw-r-----. 1 owner group 19 Jul 23 16:00 list_of_files -rw-r-----. 1 owner group... (7 Replies)
Discussion started by: cokedude
7 Replies
Ns_ConnFlush(3aolserver)				   AOLserver Library Procedures 				  Ns_ConnFlush(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_ConnFlush, Ns_ConnFlushDirect - Flush content to an open connection SYNOPSIS
#include "ns.h" int Ns_ConnFlush(conn, buf, len, stream) int Ns_ConnFlushDirect(conn, buf, len, stream) ARGUMENTS
char *buf (in) Pointer to buffer to send. Ns_Conn conn (in) Pointer to current connection. int len (in) Length of bytes pointed to by buf. int stream (in) Boolean value to indicate a streamed response. _________________________________________________________________ DESCRIPTION
These routines support sending content to the client through the connection's communcation driver. They support generating both complete single responses or streaming content through multiple calls. They both take a pointer to the current connection specified by the conn argument and a pointer to content to send specified by buf of length len. If len is negative, buf is assumed to be a null terminated string and len is calculated by strlen. The stream argument, if zero, indicates a single response should be generated. In this case, an appropriate content-length header is gen- erated, the content is sent, and the connection is closed with Ns_ConnClose. If stream is not zero, the call is assumed to be one of potential multiple calls which will send content incrementally to the client. Content streamed in this case is sent either in chunked encoding mode for HTTP/1.1 clients or directly, without a content-length as was common in pre-HTTP/1.1 applications. Applications which stream content should be sure to make a final call Ns_ConnFlush or Ns_ConnFlushDirect with stream set to zero to correctly flush and close the connection. The Ns_ConnFlush and Ns_ConnFlushDirect differ in their treatment of the given content before sending. Ns_ConnFlushDirect does not alter the content in anyway, treating is as an arbitrary array of bytes. Ns_ConnFlush assumes the content is UTF-8 text, e.g., the result of an ADP page execution. In this case, if the connection has an associated output encoding set with the Ns_ConnSetEncoding routine, it will be used to encode the content in the requested character set (e.g., from UTF-8 to iso8859-1). In addition, if the server has gzip compression enabled, the nszlib module is loaded, the connection has been marked for gzip compression with the Ns_ConnSetGzipFlag, and the size of the output data is greater than the server configured minimun gzip compression size, the content will be compressed and an appropriate header will be generated for the client. Gzip compression is not supported when content is streamed to the client. The first call to Ns_ConnFlush or Ns_ConnFlushDirect for a connection, in stream or single response mode, will result in appropriate head- ers being constructed and sent first before any user data. These headers include the basic headers constructed via Ns_ConnSetRequiredHead- ers plus any additional application specific headers queued for output via Ns_ConnSetHeaders or Ns_ConnCondSetHeaders. The Ns_ConnFlush routine may add additional headers as needed to specify chunked and/or gzip encoding. EXAMPLE
The following example generates a simple text response: Ns_ConnSetStatus(conn, 200); Ns_ConnSetType(conn, "text/plain"); Ns_ConnFlush(conn, "Hello", 5, 0); The following example demonstrates streaming: Ns_ConnSetStatus(conn, 200); Ns_ConnSetType(conn, "text/plain"); for (i = 0; i < 10; ++i) { sprintf(buf, "stream: %d0, i); Ns_ConnFlush(conn, buf, -1, 1); } Ns_ConnFlush(conn, "done!", 5, 0); SEE ALSO
Ns_ConnSend(n), Ns_ConnClose(3), Ns_ConnSetRequiredHeaders(3), Ns_ConnQueueHeaders(3) KEYWORDS
connection i/o, gzip, stream, encoding, flush AOLserver 4.5 Ns_ConnFlush(3aolserver)
All times are GMT -4. The time now is 04:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy