Category: Networking and Internet

Treballant amb cookies de sessió i PHP

Reading time: 1 – 2 minutes

A vegades necessitem parlar amb una web des de PHP i aquesta usa cookies de sessió sense les quals no podem parlar amb la web. Per agafar la cookie d’inici de sessió podem usar aquesta funció:

function getgaleta($server, $port)
{
   $cont = "";
   $ip = gethostbyname($server);
   $fp = fsockopen($ip, $port);
   if (!$fp)
   {
       return "Unknown";
   }
   else
   {
       $com = "GET http://www.barcelonastyle.com/gc/web/webesp/framesetxsl.asp HTTP/1.0rnrn";
       fputs($fp, $com);
       while (!feof($fp))
       {
           $cont .= fread($fp, 500);
       }
       fclose($fp);
       return substr($cont, strpos($cont, "Set-Cookie: ")+12, 45);
   }
}

Si ara que ja tenim la cookie el que volem fer és usar-la per fer peticions contra el site, podem usar aquesta altre funció:

function getcontent($server, $port, $file,$galeta)
{
   $cont = "";
   $ip = gethostbyname($server);
   $fp = fsockopen($ip, $port);
   if (!$fp)
   {
       return "Unknown";
   }
   else
   {
       $com = "GET http://".$server.$file." HTTP/1.0rnCookie:".$galeta."rnrn";
       fputs($fp, $com);
       while (!feof($fp))
       {
           $cont .= fread($fp, 500);
       }
       fclose($fp);
       return $cont;
   }
}

Tonto però útil, tinc moltíssimes més funcions però tampoc és qüestió de marejar, només que les he trobat útils aquestes junt amb les dues anteriors.

Understanding and Attacking DNS

Reading time: 2 – 2 minutes

dns.gif

The Domain Name System (DNS) is a distributed resource used by most every network application. DNS data is generally trusted implicitly; false data therefore can jeopardize the integrity of network traffic and allow attackers to play manin- the-middle with all traffic. DNS security depends on the client, server, and their respective trust relationship. Securing the trust relationship and building a reliable server can create a reliable and secure DNS structure for the system administrator behind your corporate and private communication requirements. Security of a DNS server varies according to its active role and name resolution requirements. Server responsibilities can be classified as one of three types. Depending on the need of the server, one specific role should be chosen; in particular situations, multiple roles can be supported simultaneously on one physical server. In this shared configuration, authoritative and resolver servers are generally together. Running an individual server for each DNS role is ideal, specifically in a large production environment. After understanding the individual roles and mechanics between each server and experiencing problems individually, an administrator can securely and reliably maintain multiple DNS roles on a single system. DNS security is custom for each type of server, each type of communication, and each common software distribution, all of which will be explained in this article via an in-depth walkthrough.

OpenSSH for Windows

Reading time: < 1 minute

OpenSSH for Windows is a free package that installs a minimal
OpenSSH server and client utilities in the Cygwin package without
needing the full Cygwin installation. This is similar to the package
formerly available from NetworkSimplicity.

The OpenSSH for Windows package provides full SSH/SCP/SFTP support.
SSH terminal support provides a familiar Windows Command prompt, while
retaining Unix/Cygwin-style paths for SCP and SFTP.

Sancho: mldonkey GUI

Reading time: < 1 minute

Sancho is a gui that connects to a p2p core application. Power users
that use p2p applications usually choose one that has core/gui
separation. sancho provides an easy to use, powerful, and configurable
gui, currently supporting the gui protocol of the popular mldonkey
core.

The sancho project is written for fun, but also to test some new
and exciting technologies. It is written in Java using the SWT widget
toolkit and can be compiled on multiple platforms with the gcj compiler
to native machine code (java=slow and bulky? not anymore! no external
java runtime required!). Windows, Linux, OSX and other popular
operating systems are supported.

sancho.jpg

HTTrack: web spider

Reading time: 2 – 2 minutes

La Daphne em va demanar si li podia fer la còpia en local d’una pàgina web d’acpuntura, ja que aquesta pertany a un portal generalista i té por de que un dia deixi d’exisitir. Així que m’ha vingut al cap provar el Pavuk un webspider que vaig veure a gentoo packages fa uns dies. No us faré perdre massa el temps, la meva valoració és: eggs!

Així que m’he dirigit al goolge i he buscat un webspider GPL i que si pogués ser tingués versió per win, per si la Daphne volia fer una altre còpia d’alguna altre pàgina. El primer de la llista he trobat el HTTrack, i d’aquí ja no he passat. Després d’usar-lo us puc assegurar que és una passada lluny de les complexitats del pavuk i el wget. No has de ser un gurú del HTTP per poder fer un mirroring sense suar.

httrack.jpg

Obviament també teniu versió per linux i per: Windows 9x/NT/2000/XP o Linux/Unix/BSD. Ho podeu comprobar a la pàgina de descàrregues. Per cert, en linux només he trobat una interficie per KDE a la Gentoo si algú en sap alguna per GNOME que m’avisi, malgrat això la interficie esta molt bé.

Maia Mailguard: GUI d’amavisd-new (PHP+perl)

Reading time: 1 – 2 minutes

A tavés d’un article de la Linux Journald he trobat una eina que em canviarà la vida a nivell del correu brossa, una passada:

The Maia Mailguard project began its life as a simple Web front end for amavisd-new, designed to let users
adjust their content filter settings and manage their quarantines from a convenient interface. The project
proved quite popular with ISPs, Web-mail providers and companies offering off-site content filtering,
however, and the needs of these larger-scale clients soon developed Maia Mailguard into something much more
sophisticated.

Maia Mailguard is a complete spam and virus management system, consisting of PHP, SQL and Perl scripts, a
MySQL or PostgreSQL database and, of course, amavisd-new, SpamAssassin and supported virus scanners. Arrays
of content filters can be managed from a single Maia interface, all sharing the same SQL database. Designed
to make content filtering, quarantine management and spam reporting easier, Maia Mailguard is in many ways a
new kind of tool for mail users.

LUFS: ex ftpfs, sshfs, etc

Reading time: 2 – 4 minutes

LUFS
is enabling you to mount into your file hierarchy a remote computer’s file
system, which is accessible by various means (ftp, ssh, etc.). Then, the access
to the remote files will be completely network transparent. In other words,
you’ll be able to read/modify remote files as if they were local, watch
movies/listen to MP3s from FTP/SSH/Gnutella servers without copying them
locally.

The reason for the
userspace stuff: there are operations only suited for userspace
(cryptography for example) and implementing them in kernel would be
bloat.

The reason for the kernel
stuff: I think it’s important to keep the file system access point at
the lowest level in order to allow all the applications to use it.
Consider KDE: it implements its own virtual file system, a great one,
but only KDE applications can take advantage of it. So does GNOME, MC
and others. Suddenly we have lots of overlapping userspace file
system implementations, a real waste…

Communication between the
kernel module and the daemon is done through UNIX domain sockets.
This makes LUFS best suited for networked file systems, where this
indirection overhead (userspace <-> kernel <-> userspace)
is small compared to the speed penalty due to the network itself.

LUFS can be regarded as
doing the same job as the VFS (virtual file system switch) in the
kernel: it is a switch, distributing the file system calls to its
supported file systems. With a big difference: LUFS file systems are
implemented in userspace. This would be a drawback for local file
systems where the access speed is important, but proves to be a huge
advantage for networked file systems where the userland
flexibility is most important.

This flexibility allowed
for implementation of SSHFS for example, in a pretty straightforward
manner, using the already existing openssh
infrastructure. Lots of other “exotic” file systems are in the
planning phase: socketfs, httpfs, webdavfs, freenetfs, etc. Just
imagine mounting a freenet file system and accessing all the goodies
as they were local…

WEB-DAV Linux File System(davfs2)

Reading time: 1 – 2 minutes

Davfs2 is a Linux file system driver that allows you to mount a WebDAV server as a local disk drive. Davfs2 uses Coda for kernel driver and neon for WebDAV interface. To get informaton about Davfs1, visit this page.

WebDAV is an extension to HTTP that allows remote collaborative authoring of Web resources, defined in RFC
2518
.

Davfs allows a remote Web server to be edited using standard applications that interact with the file system. For example, a remote Web site could be updated in-place using the same development tools that initially created the site.

UPDATE 2018/5/7Some outdated information in this post, please take a look on this webdav guide, it seems much better than my old post.

liferea: Lector de feeds per GNOME

Reading time: < 1 minute

Potser la característica més important de liferea és que suporta el mode offline, o sigui, que podem sindicar-nos on ens interessi i llegir els feeds sense connexió a internet des del tren. Suposo que ja sabeu perquè he trobat interessant aquest software. Tot i que de moment no he decidit abandonar el Bloglines si que hi ha algunes coses que em fan pujar la mosca a l’orella i si durant aquests propers dies les confirmo podria ser que acabes migrant a aquest lector de feeds que pel que he pogut probar avui no té gens de mala pinta malgrat encara esta una mica lluny de la seva versió estable.

liferea.jpg

Gentoo: Specifying only needed locales

Reading time: 2 – 3 minutes

[Gentoo Weekly News] The locales a user can choose from are built by the glibc. Usually all
available locales starting from aa_DJ (Afar locale for Djibouti) over
en_US (English locale for the USA) to zu_ZA.utf8 (Zulu locale for South
Africa) will be installed. Unless you’re working at the UN and administer
a central server for all member states, it is difficult to conceive why
you would need a system where all of these locales are installed. This
week’s tip was written with all those of you in mind who’d like to save 90
percent of the space occupied by locales in their system, by limiting the
number of installed locales to the bare minimum.

Ever since sys-libs/glibc-2.3.4.20040619-r2 has been in Portage, a
USE-flag called userlocales was provided to make sure only those locales
mentioned in /etc/locales.build are to be built and installed. As a
side-effect, this also leads to a much faster emerge of glibc, obviously.

Activate the userlocales USE flag especially for |
glibc

echo "sys-libs/glibc userlocales" >> /etc/portage/package.use

Now specify the locales you want to be able to use: (/etc/locales.build)

The format of the locales is described in the file itself.               
en_US/ISO-8859-1
en_US.UTF-8/UTF-8
de_DE/ISO-8859-1
de_DE@euro/ISO-8859-15
de_DE.UTF-8/UTF-8

For further information about locale-handling make sure you read our
Gentoo Linux Localization Guide.

Another interesting tool is app-admin/localepurge which can clean out any
installed man-page or info-file in languages you don’t need on your
system. You should read the man-page to localepurge in any case, and
configure languages you intend to keep in /etc/locale.nopurge.

By the way, if you want to prohibit the installation of all man-pages,
info-files or documentation, for example when space on your disk is
severely limited, you can add noman, nodoc and/or noinfo to FEATURES in
your /etc/make.conf.

Scroll to Top