Keyphrene's Blog

Go to the content | Go to the menu | Go to the search engine

Sunday 24 August 2008

FreeHD Gadget Vista

FreeHD vous permet de regarder vos chaines de votre Freebox HD sur votre volet Windows. D'un click vous passez en mode Fullscreen.

Read the following

Monday 18 August 2008

Magnetoscope freebox sur Synology DS107+

Freenautes, Vous possédez un Synology, vous pouvez le configurer pour avoir un magnétoscope.

Read the following

Wednesday 13 August 2008

How to install a webdav server in PHP

How to install a webdav server in PHP

Read the following

Wednesday 3 May 2006

Winnet - Only win32

How to get the DNS server list

from org.keyphrene import winnet
 
print winnet.getNetworkParams()

Result:

{'DnsServerList': '127.0.0.1', 'Domain': 'keyphrene.com', 'Hostname': 'your-XXXXXX'}

Friday 28 April 2006

SFTP

How to open a sftp connection and list a directory

import socket
from org.keyphrene import SSH2
 
HOSTNAME = "127.0.0.1"
PORT = 22
LOGIN = "login"
PWD = "password"
PATH = "/home/login"
 
 
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOSTNAME, PORT))
sock.setblocking(1)
 
ssh = SSH2.Session()
ssh.setBanner(SSH2.DEFAULT_BANNER+" Python (http://www.keyphrene.com/projects/org.keyphrene)")
ssh.startup(sock)
ssh.setPassword(LOGIN, PWD)
 
# open a SFTP channel
sftp = ssh.SFTP()
 
handle = sftp.openDir(PATH)
if handle:
	## Open a sftp connection and list a directory
	while 1:
		data = sftp.readDir(handle)
		if not data: break
		print data
 
	## Open a sftp connection and list a directory with attributes
	for f, attr in sftp.listDir(handle):
		print f, attr
 
# close the SFTP channel
sftp.close(handle)
sftp.shutdown()
ssh.close()

SSH

A simple connection

import socket
from org.keyphrene import SSH2
 
 
HOSTNAME = "127.0.0.1"
PORT = 22
LOGIN = "login"
PWD = "password"
 
 
# A simple connection
 
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((HOSTNAME, PORT))
sock.setblocking(1)
 
ssh = SSH2.Session()
ssh.setBanner(SSH2.DEFAULT_BANNER+" Python (http://www.keyphrene.com/projects/org.keyphrene)")
ssh.startup(sock)
ssh.setPassword(LOGIN, PWD)
 
# here, your operations
 
ssh.close()

Digest & HMAC

Digest

from org.keyphrene.crypto import Digest, HMAC
 
########
# SHA 1
d = Digest("sha1")
print "SHA1 Size: %d" % d.get_size()
d.update("naja")
print "SHA1: %s" % d.digest()
 
 
########
# MD5 1
d = Digest("md5")
print "MD5 Size: %d" % d.get_size()
d.update("naja")
print "MD5: %s" % d.digest()

List of Digests: sha, sha1, md5, md4, md2, mdc2, rmd160

HMAC

from org.keyphrene.crypto import Digest, HMAC
 
key = "a key"
digestmod = "md5"
hmac = HMAC(key, digestmod)
hmac.update("your data")
print hmac.final()

List of digestmod: md5, sha, sha1

CRC64

Calculate the cyclic redundancy ...

from org.keyphrene import crc64
 
print crc64.string("your data")

Hunspell

Hunspell is a spell checker.

from org.keyphrene import hunspell
 
spell = hunspell.Hunspell("./fr_FR.aff","./fr_FR.dic")
word = "copi"
print spell.spell(word)
print spell.suggest(word)