Re: Printing a RFC on non-US PAPERsize

2001-11-26 Thread Tommi Komulainen

On Mon, Nov 26, 2001 at 11:02:36AM +0100, Lambrecht, Joris wrote:
 
 I'm getting a stomach ache trying to figure out how best to print an RFC
 without having the impression i'm printing drafts of a draft. The formatting
 goes bananas when i try to print it on any known paper size (A4 Letter ...).
 Does there exist a website, a tool or a procedure to make rfc's printable in
 an adequate way ?

Hi,

I've used a simple script that strips all white space between the end of
the page and the start of the next space and inserts a page break there
instead.  Basically, that should modify the drafts so that they can be
properly printed on any paper size.  Though, I've only tested A4.

I'll attach my boosted script that also downloads the requested
rfc/draft and then reformats it as described above.  But beware, the
logic to determine the location of page break is extremely stupid.
Don't count on getting the rfc's intact :)

Oh, and mpage -2 works nicely for the printing part...


-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6


#!/usr/bin/env python

SERVER,RFCDIR,DRAFTDIR = 'ftp.funet.fi','/rfc','/internet-drafts'

import sys
if len(sys.argv)  2:
sys.stderr.write(\
usage: rfc-get [rfc-number | draft-name] ...
)
sys.exit(1)

import ftplib,os

ftp = ftplib.FTP(SERVER)
ftp.set_pasv(1)
ftp.login()


import re
end_re =   re.compile(r'^\S+.+\[Page \d+]\s*$')
start_re = re.compile(r'^(Internet|RFC)\s.+$')

for arg in sys.argv[1:]:
if arg[:3] == 'rfc': arg = arg[3:]
elif arg[:6] == 'draft-': arg = arg[6:]
if arg[-4:] == '.txt': arg = arg[:-4]
try: 
arg = int(arg)
filename = 'rfc%d.txt' % arg
dir = RFCDIR
except ValueError:
filename = 'draft-%s.txt' % arg
dir = DRAFTDIR

print 'retrieving %s/%s' % (dir,filename)

ftp.cwd(dir)

printable = 1
file = open(filename, 'wt')

def printer(line):
global file,printable
if end_re.match(line):  
file.write(line + '\n')
file.write('\f\n')
printable = 0
elif start_re.match(line):
file.write(line + '\n')
printable = 1
elif printable:
file.write(line + '\n')

try:
try: ftp.retrlines('RETR ' + filename, printer)
finally: file.close()
except ftplib.error_perm, err:
print err
os.unlink(filename)


ftp.quit()




msg04702/pgp0.pgp
Description: PGP signature


Re: Printing a RFC on non-US PAPERsize

2001-11-26 Thread Tommi Komulainen
On Mon, Nov 26, 2001 at 11:02:36AM +0100, Lambrecht, Joris wrote:
 
 I'm getting a stomach ache trying to figure out how best to print an RFC
 without having the impression i'm printing drafts of a draft. The formatting
 goes bananas when i try to print it on any known paper size (A4 Letter ...).
 Does there exist a website, a tool or a procedure to make rfc's printable in
 an adequate way ?

Hi,

I've used a simple script that strips all white space between the end of
the page and the start of the next space and inserts a page break there
instead.  Basically, that should modify the drafts so that they can be
properly printed on any paper size.  Though, I've only tested A4.

I'll attach my boosted script that also downloads the requested
rfc/draft and then reformats it as described above.  But beware, the
logic to determine the location of page break is extremely stupid.
Don't count on getting the rfc's intact :)

Oh, and mpage -2 works nicely for the printing part...


-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6
#!/usr/bin/env python

SERVER,RFCDIR,DRAFTDIR = 'ftp.funet.fi','/rfc','/internet-drafts'

import sys
if len(sys.argv)  2:
sys.stderr.write(\
usage: rfc-get [rfc-number | draft-name] ...
)
sys.exit(1)

import ftplib,os

ftp = ftplib.FTP(SERVER)
ftp.set_pasv(1)
ftp.login()


import re
end_re =   re.compile(r'^\S+.+\[Page \d+]\s*$')
start_re = re.compile(r'^(Internet|RFC)\s.+$')

for arg in sys.argv[1:]:
if arg[:3] == 'rfc': arg = arg[3:]
elif arg[:6] == 'draft-': arg = arg[6:]
if arg[-4:] == '.txt': arg = arg[:-4]
try: 
arg = int(arg)
filename = 'rfc%d.txt' % arg
dir = RFCDIR
except ValueError:
filename = 'draft-%s.txt' % arg
dir = DRAFTDIR

print 'retrieving %s/%s' % (dir,filename)

ftp.cwd(dir)

printable = 1
file = open(filename, 'wt')

def printer(line):
global file,printable
if end_re.match(line):  
file.write(line + '\n')
file.write('\f\n')
printable = 0
elif start_re.match(line):
file.write(line + '\n')
printable = 1
elif printable:
file.write(line + '\n')

try:
try: ftp.retrlines('RETR ' + filename, printer)
finally: file.close()
except ftplib.error_perm, err:
print err
os.unlink(filename)


ftp.quit()



pgptQWqyWSTam.pgp
Description: PGP signature


Re: snort problem

2001-02-20 Thread Tommi Komulainen

On Tue, Feb 20, 2001 at 11:21:45AM +0200, Viljo Marrandi wrote:
 Feb 20 10:54:17 equinoxe modprobe: modprobe: Can't locate module net-pf-17
 Feb 20 10:54:17 equinoxe snort: ERROR: OpenPcap() device eth0 open:
 ^Isocket: Socket type not supported
 
 Firstly, what is net-pf-17? I couldn't find it anywhere (grepped thru
 kernel source). And why it says that socket type not supported? I
 installed all required packages for it - libc6_2.2.1 and libpcap0. What
 couls possibly be wrong?

First of all, that 'pf' stands for 'protocol family', like PF_INET for IP or
PF_IPX for IPX and so on.  You have the list of protocol families in the
file /usr/include/linux/socket.h, from there you'll notice that AF_PACKET
(yes, it is the same as PF_PACKET, don't ask why the duplicate naming)
has the magic value of 17.  

So in short, you're missing the packet socket support from your kernel.
Once you enable it, snort/tcpdump/anything that uses libpcap should work.


-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6

 PGP signature


Re: OpenSSH and CVS

2001-02-20 Thread Tommi Komulainen

On Tue, Feb 20, 2001 at 08:49:36AM -0500, Chris Matta wrote:
 This is easy:
 
 as the user that runs the CVS scripts:
 run ssh-keygen
 it will run thru and ask where you want the file (~/.ssh/identity will
 be fine)
 when prompted for a password just hit return, and again on the next line
 now copy the contents of ~/.ssh/identity.pub to the
 ~/.ssh/authorized_keys file on the machines you need to get to, if it
 doesn't exist create it.
 you should now be able to login without a password.

Also note that if all you wish to provide is CVS access, you should
restrict the access only to the CVS server, for example by putting
something similar to the following in the authorized_keys file:

command="/usr/bin/cvs server",no-port-forwarding,no-X11-forwarding, \
no-agent-forwarding 1024 35 1234...4321 [EMAIL PROTECTED]

The above should be on one line, I don't know if the backslash-
continuation works in authorized_keys, I haven't tried.

You might also find some interesting ideas from the following location:

http://www.kitenet.net/programs/sshcvs/

Have fun.

-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6

 PGP signature


Re: snort problem

2001-02-20 Thread Tommi Komulainen
On Tue, Feb 20, 2001 at 11:21:45AM +0200, Viljo Marrandi wrote:
 Feb 20 10:54:17 equinoxe modprobe: modprobe: Can't locate module net-pf-17
 Feb 20 10:54:17 equinoxe snort: ERROR: OpenPcap() device eth0 open:
 ^Isocket: Socket type not supported
 
 Firstly, what is net-pf-17? I couldn't find it anywhere (grepped thru
 kernel source). And why it says that socket type not supported? I
 installed all required packages for it - libc6_2.2.1 and libpcap0. What
 couls possibly be wrong?

First of all, that 'pf' stands for 'protocol family', like PF_INET for IP or
PF_IPX for IPX and so on.  You have the list of protocol families in the
file /usr/include/linux/socket.h, from there you'll notice that AF_PACKET
(yes, it is the same as PF_PACKET, don't ask why the duplicate naming)
has the magic value of 17.  

So in short, you're missing the packet socket support from your kernel.
Once you enable it, snort/tcpdump/anything that uses libpcap should work.


-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6


pgpFsXoeWKIK4.pgp
Description: PGP signature


Re: OpenSSH and CVS

2001-02-20 Thread Tommi Komulainen
On Tue, Feb 20, 2001 at 08:49:36AM -0500, Chris Matta wrote:
 This is easy:
 
 as the user that runs the CVS scripts:
 run ssh-keygen
 it will run thru and ask where you want the file (~/.ssh/identity will
 be fine)
 when prompted for a password just hit return, and again on the next line
 now copy the contents of ~/.ssh/identity.pub to the
 ~/.ssh/authorized_keys file on the machines you need to get to, if it
 doesn't exist create it.
 you should now be able to login without a password.

Also note that if all you wish to provide is CVS access, you should
restrict the access only to the CVS server, for example by putting
something similar to the following in the authorized_keys file:

command=/usr/bin/cvs server,no-port-forwarding,no-X11-forwarding, \
no-agent-forwarding 1024 35 1234...4321 [EMAIL PROTECTED]

The above should be on one line, I don't know if the backslash-
continuation works in authorized_keys, I haven't tried.

You might also find some interesting ideas from the following location:

http://www.kitenet.net/programs/sshcvs/

Have fun.

-- 
Tommi Komulainen [EMAIL PROTECTED]
GPG 1024D/68388EE66FD6 DD79 EB38 BF6F 3533  09C0 04A8 9871 6838 8EE6


pgpBFWvuAFKy4.pgp
Description: PGP signature