Affichage des articles dont le libellé est IP Network. Afficher tous les articles
Affichage des articles dont le libellé est IP Network. Afficher tous les articles

vendredi 29 juin 2012

How to install nTOP 4 on CentOS 6 by RPM

nTOP is a Network Tap program. It displays a summary of network usage by machines on your network in a format reminiscent of the unix top utility. It can also be run in web mode, which allows the display to be browsed with a web browser.
1. Install RPMforge repo :
# rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
Note : you can find the lastest of rpmforge repo at http://pkgs.repoforge.org/rpmforge-release
2. Install necessary packages for nTOP :
# yum install graphviz rrdtool rrdtool-devel geoip geoip-devel net-snmp-libs gdbm gdbm-devel
3. Install nTOP :
# cd /usr/src
# wget http://dl.marmotte.net/rpms/redhat/el6/x86_64/ntop-4.0.3-1.el6/ntop-4.0.3-1.el6.x86_64.rpm
# rpm -ivh ntop-4.0.3-1.el6.x86_64.rpm
# chkconfig ntop on
4. Set Admin password :
# ntop -A
5. Start nTOP service :
# service ntop start
6. Confirm nTOP is working :
# lsof -i :3000
# lsof -i :3001
Note : TCP 3000 for HTTP and TCP 3001 for HTTPs
7. Secure ntop access from outside :
a. Browse to https://ip-address.your.nTOP.server:3001
b. Click “Admin” > “Configure” > “Protect URLs”
c. Enter username “admin” and your password (set in step 4 above) when prompted.
d. Click “Add URL” then “Add URL” again.
NOTE: This will require a username and password to access https://ip-address.your.nTOP.server:3001

source  :  http://saroot.org/blog/how-to-install-ntop-4-on-centos-6-by-rmp-package/

jeudi 13 octobre 2011

Hum un nouveau lan, qu'est ce qui se passe par là ?

1) Nmap

nmap -v -sP 192.168.240.0/24 | grep -v "appears to be down" | grep Host

vendredi 7 octobre 2011

Recevoir un mail à chaque connexion ssh

Pour certains serveurs, il peut s'avérer pratique de savoir qui se connecte en ssh.



A l'aide du script suivant à ajouter au fichier  /etc/ssh/sshrc, il est possible de recevoir un mail à chaque connexion.

#!/bin/sh
DATE=`date "+%d-%m-%Y %H:%M"`
IP=`echo $SSH_CONNECTION | awk '{print $1}'`
REVERSE=`dig -x $IP +short`
 
# Message + envoi du mail
echo "USER : $USER
IP : $IP
ReverseDNS : $REVERSE
Date : $DATE
 
" | mail -s "[SSH] $DATE - Connexion de $USER" your_email@domaine.com

Source 

mardi 20 septembre 2011

Y'a quoi dans mon pcap

Parfois, un éditeur hexadécimal  pour fouiller dans un fichier data (raw) qui provient d'un pcap ça fait mal à la tête.
York est passé par là. A noter qu'il est possible de faire directement des captures avec ce logiciel.

Quelques précisons, in english :


York::Log all network traffic
Description:
  • Log source, destination [fqdn or ip address] and packet size of all network traffic on your network, of course also outbound traffic. The network card will be set into promiscuous mode.
  • Save sniffed HTTP and FTP files. Just for fun, pictures are shown in a slideshow and in a screensaver like window.
  • Sniff for HTTP, FTP, POP3, SMTP, SMB, VNC and AIM password/hash and HTTP cookies like 'GX'.
  • Select a client and follow his clicks in your browser. [WebSession]
  • Screensaver included. Shows sniffed pictures in a slideshow.
  • For advanced user: You can capture traffic into a pcap file, send a pcap file and replay a pcap file.
  • For advanced user: You can restrict captured traffic by tcpdump filters.
Please note, WinPcap [www.winpcap.org] is used to get the network traffic. The Setup will install WinPcap automatically.
The columns in the log file are tabulator separated for easy import into Excel or so.
One line in the log file looks like this:
19.08.2003 02:49 [0:01:03] theszdbg <-> www.traffichome.com http 55 kByte 56329 Bytes
If your need more or other information in the logfile or have feature requests, please send me an mail.












Active connections and their data volume:
Sniffed HTTP and FTP files:
Sniffed HTTP, FTP, POP3, SMTP, SMB, VNC and AIM passwords/hash's:
Slideshow of sniffed HTTP and FTP pictures:




Source : http://thesz.diecru.eu/content/york.php

Je suis sur le net, mais je passe par ou et je laisse quoi comme traces ?

1) Proxy ou pas : http://www.lagado.com/proxy-test
2) Mes traces : http://www.anonymat.org/vostraces/index.php et le site de la CNIL


vendredi 10 juin 2011

Dnsmasq : DNS (cache) / DHCP & TFTP

Dnsmasq est un serveur DHCP et DNS à faible empreinte mémoire. Il offre à la fois les services DNS, DHCP et TFTP pour un réseau local (LAN).

Dnsmasq accepte les requêtes DNS et y réponds soit en utilisant un petit cache local, soit en effectuant une requête à un serveur DNS récursif externe (par exemple celui de votre fournisseur d'accès internet). Il charge le contenu du fichier /etc/hosts afin que les noms locaux n'apparaissant pas dans les DNS globaux soient tout de même résolus, et assure également la résolution de nom pour les hôtes présents dans le service DHCP.

Le serveur DHCP Dnsmasq DHCP supporte les définitions d'adresses statiques et les réseaux multiples. Il envoie par défaut un jeu raisonnable de paramètres DHCP, et peut être configuré pour envoyer n'importe quel option DHCP. Il inclut un serveur TFTP sécurisé en lecture seule permettant le démarrage via le réseau/PXE de clients DHCP et supporte également le protocole BOOTP.

Ce logiciel est disponible pour la majeur partie des distributions linux via yum/apt ou autres.

Dnsmasq supporte IPv6 pour le DNS et TFTP mais pas pour le DHCP

Exemple de configuration :

# Configuration file for dnsmasq.
#
# Format is one option per line, legal options are the same
# as the long options legal on the command line. See
# "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details.

# The following two options make you a better netizen, since they
# tell dnsmasq to filter out queries which the public DNS cannot
# answer, and which load the servers (especially the root servers)
# uneccessarily. If you have a dial-on-demand link they also stop
# these requests from bringing up the link uneccessarily.

# Never forward plain names (without a dot or domain part)
domain-needed
# Never forward addresses in the non-routed address spaces.
bogus-priv


# Uncomment this to filter useless windows-originated DNS requests
# which can trigger dial-on-demand links needlessly.
# Note that (amongst other things) this blocks all SRV requests,
# so don't use it if you use eg Kerberos.
# This option only affects forwarding, SRV records originating for
# dnsmasq (via srv-host= lines) are not suppressed by it.
#filterwin2k

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=
resolv-file=/etc/dnsmasqupstreamservers

# By default, dnsmasq will send queries to any of the upstream
# servers it knows about and tries to favour servers to are known
# to be up. Uncommenting this forces dnsmasq to try each query
# with each server strictly in the order they appear in
# /etc/resolv.conf
#strict-order

# If you don't want dnsmasq to read /etc/resolv.conf or any other
# file, getting its servers from this file instead (see below), then
# uncomment this
#no-resolv

# If you don't want dnsmasq to poll /etc/resolv.conf or other resolv
# files for changes and re-read them then uncomment this.
#no-poll

# Add other name servers here, with domain specs if they are for
# non-public domains.
#server=/localnet/192.168.0.1
#server=166.70.63.3

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
#local=/localnet/

# Add domains which you want to force to an IP address here.
# The example below send any host in doubleclick.net to a local
# webserver.
#address=/doubleclick.net/127.0.0.1

# If you want dnsmasq to change uid and gid to something other
# than the default, edit the following lines.
#user=
#group=

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
#interface=
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
# you use this.)
#listen-address=
# If you want dnsmasq to provide only DNS service on an interface,
# configure it as shown above, and then use the following line to
# disable DHCP on it.
#no-dhcp-interface=

# On systems which support it, dnsmasq binds the wildcard address,
# even when it is listening on only some interfaces. It then discards
# requests that it shouldn't reply to. This has the advantage of
# working even when interfaces come and go and change address. If you
# want dnsmasq to really bind only the interfaces it is listening on,
# uncomment this option. About the only time you may need this is when
# running another nameserver on the same machine.
#bind-interfaces

# If you don't want dnsmasq to read /etc/hosts, uncomment the
# following line.
#no-hosts
# or if you want it to read another file, as well as /etc/hosts, use
# this.
#addn-hosts=/etc/banner_add_hosts
addn-hosts=/etc/dnsmasqhosts

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
#expand-hosts

# Set the domain for dnsmasq. this is optional, but if it is set, it
# does the following things.
# 1) Allows DHCP hosts to have fully qualified domain names, as long
# as the domain part matches this setting.
# 2) Sets the "domain" DHCP option thereby potentially setting the
# domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
#domain=thekelleys.org.uk

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.0.50,192.168.0.150,12h

# This is an example of a DHCP range where the netmask is given. This
# is needed for networks we reach the dnsmasq DHCP server via a relay
# agent. If you don't know what a DHCP relay agent is, you probably
# don't need to worry about this.
#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h

# This is an example of a DHCP range with a network-id, so that
# some DHCP options may be set only for this network.
#dhcp-range=red,192.168.0.50,192.168.0.150

# Supply parameters for specified hosts using DHCP. There are lots
# of valid alternatives, so we will give examples of each. Note that
# IP addresses DO NOT have to be in the range given above, they just
# need to be on the same network. The order of the parameters in these
# do not matter, it's permissble to give name,adddress and MAC in any order

# Always allocate the host with ethernet address 11:22:33:44:55:66
# The IP address 192.168.0.60
#dhcp-host=11:22:33:44:55:66,192.168.0.60

# Always set the name of the host with hardware address
# 11:22:33:44:55:66 to be "fred"
#dhcp-host=11:22:33:44:55:66,fred

# Always give the host with ethernet address 11:22:33:44:55:66
# the name fred and IP address 192.168.0.60 and lease time 45 minutes
#dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m
dhcp-host=00:0e:2e:0d:44:be,Bunsen,192.168.0.106

# Give the machine which says it's name is "bert" IP address
# 192.168.0.70 and an infinite lease
#dhcp-host=bert,192.168.0.70,infinite

# Always give the host with client identifier 01:02:02:04
# the IP address 192.168.0.60
#dhcp-host=id:01:02:02:04,192.168.0.60

# Always give the host with client identifier "marjorie"
# the IP address 192.168.0.60
#dhcp-host=id:marjorie,192.168.0.60

# Enable the address given for "judge" in /etc/hosts
# to be given to a machine presenting the name "judge" when
# it asks for a DHCP lease.
#dhcp-host=judge

# Never offer DHCP service to a machine whose ethernet
# address is 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,ignore

# Ignore any client-id presented by the machine with ethernet
# address 11:22:33:44:55:66. This is useful to prevent a machine
# being treated differently when running under different OS's or
# between PXE boot and OS boot.
#dhcp-host=11:22:33:44:55:66,id:*

# Send extra options which are tagged as "red" to
# the machine with ethernet address 11:22:33:44:55:66
#dhcp-host=11:22:33:44:55:66,net:red

# Send extra options which are tagged as "red" to
# any machine with ethernet address starting 11:22:33:
#dhcp-host=11:22:33:*:*:*,net:red

# Send extra options which are tagged as "red" to any machine whose
# DHCP vendorclass string includes the substring "Linux"
#dhcp-vendorclass=red,Linux

# Send extra options which are tagged as "red" to any machine one
# of whose DHCP userclass strings includes the substring "accounts"
#dhcp-userclass=red,accounts

# If this line is uncommented, dnsmasq will read /etc/ethers and act
# on the ethernet-address/IP pairs found there just as if they had
# been given as --dhcp-host options. Useful if you keep
# MAC-address/host mappings there for other purposes.
#read-ethers

# Send options to hosts which ask for a DHCP lease.
# See RFC 2132 for details of available options.
# Note that all the common settings, such as netmask and
# broadcast address, DNS server and default route, are given
# sane defaults by dnsmasq. You very likely will not need any
# any dhcp-options. If you use Windows clients and Samba, there
# are some options which are recommended, they are detailed at the
# end of this section.
# For reference, the common options are:
# subnet mask - 1
# default router - 3
# DNS server - 6
# broadcast address - 28

# Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5
#dhcp-option=42,192.168.0.4,10.10.0.5
dhcp-option=3,192.168.0.1

# Set the NTP time server address to be the same machine as
# is running dnsmasq
#dhcp-option=42,0.0.0.0

# Set the NIS domain name to "welly"
#dhcp-option=40,welly

# Set the default time-to-live to 50
#dhcp-option=23,50

# Set the "all subnets are local" flag
#dhcp-option=27,1

# Send the etherboot magic flag and then etherboot options (a string).
#dhcp-option=128,e4:45:74:68:00:00
#dhcp-option=129,NIC=eepro100

# Specify an option which will only be sent to the "red" network
# (see dhcp-range for the declaration of the "red" network)
#dhcp-option=red,42,192.168.1.1

# The following DHCP options set up dnsmasq in the same way as is specified
# for the ISC dhcpcd in
# http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt
# adapted for a typical dnsmasq installation where the host running
# dnsmasq is also the host running samba.
# you may want to uncomment them if you use Windows clients and Samba.
#dhcp-option=19,0 # option ip-forwarding off
#dhcp-option=44,0.0.0.0 # set netbios-over-TCP/IP nameserver(s) aka WINS server(s)
#dhcp-option=45,0.0.0.0 # netbios datagram distribution server
#dhcp-option=46,8 # netbios node type
#dhcp-option=47 # empty netbios scope.

# Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client
# probably doesn't support this......
#dhcp-option=119,eng.apple.com,marketing.apple.com

# Send encapsulated vendor-class specific options. The vendor-class
# is sent as DHCP option 60, and all the options marked with the
# vendor class are send encapsulated in DHCP option 43. The meaning of
# the options is defined by the vendor-class. This example sets the
# mtftp address to 0.0.0.0 for PXEClients
#dhcp-option=vendor:PXEClient,1,0.0.0.0

# Set the boot filename and tftpd server name and address
# for BOOTP. You will only need this is you want to
# boot machines over the network.
#dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3

# Set the limit on DHCP leases, the default is 150
#dhcp-lease-max=150

# The DHCP server needs somewhere on disk to keep its lease database.
# This defaults to a sane location, but if you want to change it, use
# the line below.
#dhcp-leasefile=/var/lib/misc/dnsmasq.leases

# Set the DHCP server to authoritative mode. In this mode it will barge in
# and take over the lease for any client which broadcasts on the network,
# whether it has a record of the lease or not. This avoids long timeouts
# when a machine wakes up on a new network. DO NOT enable this if there's
# the slighest chance that you might end up accidentally configuring a DHCP
# server for your campus/company accidentally. The ISC server uses the same
# the same option, and this URL provides more information:
# http://www.isc.org/index.pl?/sw/dhcp/authoritative.php
#dhcp-authoritative

# Set the cachesize here.
#cache-size=150

# If you want to disable negative caching, uncomment this.
#no-negcache

# Normally responses which come form /etc/hosts and the DHCP lease
# file have Time-To-Live set as zero, which conventionally means
# do not cache further. If you are happy to trade lower load on the
# server for potentially stale date, you can set a time-to-live (in
# seconds) here.
#local-ttl=

# If you want dnsmasq to detect attempts by Verisign to send queries
# to unregistered .com and .net hosts to its sitefinder service and
# have dnsmasq instead return the correct NXDOMAIN response, uncomment
# this line. You can add similar lines to do the same for other
# registries which have implemented wildcard A records.
#bogus-nxdomain=64.94.110.11

# If you want to fix up DNS results from upstream servers, use the
# alias option. This only works for IPv4.
# This alias makes a result of 1.2.3.4 appear as 5.6.7.8
#alias=1.2.3.4,5.6.7.8
# and this maps 1.2.3.x to 5.6.7.x
#alias=1.2.3.0,5.6.7.0,255.255.255.0


# Change these lines if you want dnsmasq to serve MX records.

# Return an MX record named "maildomain.com" with target
# servermachine.com and preference 50
#mx-host=maildomain.com,servermachine.com,50

# Set the default target for MX records created using the localmx option.
#mx-target=servermachine.com

# Return an MX record pointing to the mx-target for all local
# machines.
#localmx

# Return an MX record pointing to itself for all local machines.
#selfmx

# Change the following lines if you want dnsmasq to serve SRV
# records. These are useful if you want to serve ldap requests for
# Active Directory and other windows-originated DNS requests.
# See RFC 2782.
# You may add multiple srv-host lines.
# The fields are ,,,,
# If the domain part if missing from the name (so that is just has the
# service and protocol sections) then the domain given by the domain=
# config option is used. (Note that expand-hosts does not need to be
# set for this to work.)

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 289
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389

# A SRV record sending LDAP for the example.com domain to
# ldapserver.example.com port 289 (using domain=)
#domain=example.com
#srv-host=_ldap._tcp,ldapserver.example.com,389

# Two SRV records for LDAP, each with different priorities
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,1
#srv-host=_ldap._tcp.example.com,ldapserver.example.com,389,2

# A SRV record indicating that there is no LDAP server for the domain
# example.com
#srv-host=_ldap._tcp.example.com


# Change the following lines to enable dnsmasq to serve TXT records.
# These are used for things like SPF and zeroconf. (Note that the
# domain-name expansion done for SRV records _does_not
# occur for TXT records.)

#Example SPF.
#txt-record=example.com,v=spf1 a -all

#Example zeroconf
#txt-record=_http._tcp.example.com,name=value,paper=A4


# For debugging purposes, log each DNS query as it passes through
# dnsmasq.
#log-queries

# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf

jeudi 3 février 2011

WifiZoo

Introduction

Wifizoo est un outil de capture d'informations à partir de réseau wifi ouvert.

Configuration dans BT3 beta

Editez: /usr/local/etc/kismet.conf
ligne 27 : indiquez votre interface wifi. ex :
source = rt73,rausb0,Ralink
Lancez Kismet
kismet -x
Editez: /pentest/wireless/wifizoo/scapy.py
ligne 13215 : AJOUTEZ la ligne et indiquez votre interface wifi. ex :
conf.iface = 'rt73,rausb0,Ralink'
Editez: /pentest/wireless/wifizoo/wifizoo.py
ligne 49 : indiquez votre interface wifi. ex :
conf.iface = 'rausb0'
Ensuite il ne reste plus qu'à lancer wifizoo.py dans un shell.

Usage

Wifizoo en mode live

version 1.3 et 1.4

démarrage

placez vous dans le répertoire de wifizoo et tappez :
python wifizoo.py
Image:wifizoo1.jpg
Choix du mode Live ou Pcap
Image:wifizoo2.jpg
sélectionnez votre interface
Image:wifizoo3.jpg
Scan aléatoire ou fixé sur un seul channel
Image:wifizoo4.jpg
Choix de la bande (A/BG/ABG)
Image:wifizoo5.jpg
Choix du server local pour afficher le gui html : LO
Image:wifizoo6.jpg

Interface graphique

Nous allons utiliser les onglets pour accéder aux différents types d'information capturés (cookies, ftp data, etc...)
Image:wifizoo7.jpg
Exemple de capture de données ftp, ip, user pass :)
Image:wifizoo8.jpg
Exemple de captures de cookies, punbb et gmail :)
Image:wifizoo9.jpg
Cliquer sur le lien afin de forger le cookie
Image:wifizoo9b.jpg
Une fois le cookie forgé, il faut cliquer sur l'ip pour accéder à la page que la victime est en train de consulter
Image:wifizoo10.jpg
On arrive sur la page "d'accueil" et comme on l'a vu précédemment, la personne surfait sur gmail, donc on va cliquer sur gmail, logique.
Image:wifizoo11.jpg
Et voila, nous nous trouvons dans la session gmail.
Image:wifizoo12.jpg

Wifizoo en mode Pcap

ATTENTION : seulement disponible avec la version 1.4 (version 1.3 + patch)

Récuperation d'un fichier cap

Suite à un scan avec airodump, nous nous retrouvons avec un fichier cap. Au lieu de s'amuser à l'analyser avec wireshark pour en tirer des infos intéressantes, nous allons utiliser wifizoo qui va s'occuper de nous trouver le meilleur :)

Décryptage du fichier

Il peut arriver que notre fichier soit cryptà par une protection ultra résistante comme le WEP. Dans ce as nous allons utliser l'outil decrypt pour les décrypter.
dans un shell tappez :
bt wiscan # decrypt -p MA:KE:YW:EP:00 -m MA:ST:AT:IO:N! -e capture-01.cap -d capture.cap

démarrage

placez vous dans le répertoire de wifizoo et tapez :
python wifizoo.py
Image:wifizoo1.jpg
Choix du mode Live ou Pcap
Image:wifizoo1p.jpg
Entrez le chemin du fichier de capture
Image:wifizoo2p.jpg
Ca fonctionne
Image:wifizoo3p.jpg
Choix du server local pour afficher le gui html : LO
Image:wifizoo4p.jpg
On constate que les données sont bien interpretées
Image:wifizoo5p.jpg

Interface graphique

Nous allons utiliser les onglets pour accéder aux différents types d'information capturés (cookies, ftp data, etc...)
Image:wifizoo6p.jpg
Exemple de captures de cookies, punbb :) Cliquer sur le lien afin de forger le cookie
Image:wifizoo7p.jpg
Une fois le cookie forgé, il faut cliquer sur l'ip pour accéder à la page que la victime est en train de consulter
Image:wifizoo8p.jpg
Et voila, nous nous trouvons loggué dans la session de la victime.
Image:wifizoo9p.jpg

bonne capture

Image:wifizooEND.jpg

Vidéo

Wifizoo 1.3, vol de session gmail : http://backtrack-fr.net/test/wifizoo13.ogv

Liens externes 

Wifizoo 1.3, vol de session gmail : http://backtrack-fr.net/test/wifizoo13.ogv

 

Tuto Xplico internet decodeur

la première partie présente l'installation d'xplico et son web ui, la seconde partie montre son utilisation en live sur du Wep (video + texte); la troisième partie montre son utilisation réelle c'est à dire en forensics sur un fichier pcap (video + texte), et la partie 4 en cli.

Alors, Xplico permet quoi ? il permet d'avoir une vision "humaine" du contenu de votre pcap, si vous prenez wireshark, vous voyez trucs muche tcp icmp etc, vous pouvez extraire l'intégralité via follow tcp stream, mais pour une visualisation rapide du contenu cela n'est pas l'idéal.

C'est là qu'intervient xplico, il va permettre de voir directement les images videos etc.

Let's go on installe le cool tool, je pars sur une base ubuntu, mais pour les autres ca montre bien les dépendances et ne devrait pas poser de problèmes majeurs.


sudo su
#libpcap est nécessaire, mais on va foutre des trucs en plus pour les scripts.

apt-get install sqlite tcpdump tshark
libx11-dev libxt-dev libxi-dev apache2 php5 php5-sqlite build-essential perl zlib1g-dev libpcap-dev libsqlite0-dev libmysqlclient15-dev python2.5-minimal python2.5 python-all
#sqlite car il nous faut la version 2 d'sqlite + la lib-dev
#(nommé sqlite dans les dépots ubuntu)
#apache2 ca c'est pour la web ui (interface web) pas
#obigé php5-sqilte idem
#tcpdump tshark pour les scripts et de toute manière
#libpcap nécessaire (tshark peut ne pas etre utilisé ou rempacé
#par wireshark qui le contient)
#zlib1g ca c'est pour geoip
#libx* pour pcl6 (option)


cd /tmp
wget http://downloads.sourceforge.net/project/xplico/xplico/version%200.5.2/xplico-0.5.2.tgz

tar zxvf xplico-0.5.2.tgz
wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP-1.4.5.tar.gztar zxvf GeoIP-1.4.5.tar.gz
cd GeoIP-1.4.5
./configure
make
make install
rm -f *.tar.gz
cd /tmp/xplico
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gzip -d GeoLiteCity.dat.gz
rm -f *dat.gz
make
cd ..
wget http://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/ghostpdl/ghostpdl-8.70.tar.bz2
tar jxvf ghostpdl-8.70.tar.bz2
#de ghostpcl on a juste besoin de pcl6 c'est necessaire pour "network printer job"
rm -f *.bz2
cd ghostpdl-8.70
make
#ca ca prend du temps...
cd ..
cp /tmp/ghostpdl-8.70/main/obj/pcl6 /tmp/xplico/
rm -rf
ghostpdl-8.70
cd /tmp/xplico
make install

#Ça c'était la part 1 de l'installation, maintenant on installe la web ui
#(interface web)

cd /var/www
wget http://downloads.sourceforge.net/project/xplico/xplico/version%200.5.2/xplico_interface-0.5.2.tgz
tar zxvf xplico_interface-0.5.2.tgz
rm -f *2.tgz

#le chmod recursif en 777 c'est si vous avez un problème d'accès,
#attention ca offre les droits max,
#lecture écriture exécution pour tous les fichiers groupes utilisateurs.

chmod -R 777 /gui.xplico.org

On continue ?
Ok il faut que l'interface web soit accessible pour apache avec toutes les options activées et allow override allow.

Pour plus de simplicité vous pouvez directement télécharger la conf (ca ne touche en rien apache, ça active tout pour xplico et uniquement xplico.

cd /etc/apache2/sites-enabled
wget http://bricowifi.free.fr/xplico

Ensuite dans /etc/apache2/ports.conf vous devez ajouter xplico et son port
Voici un extrait du mien avec l'ajout en rouge:

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
# xplico Host port
NameVirtualHost *:9876
Listen 9876
NameVirtualHost *:80
Listen 80

Il faut aussi éditer php.ini pour le down, l'upload max:

nano /etc/php5/apache2/php.ini

post_max_size = 100M

upload_max_filesize = 100M

On oublie pas d'activer le mode rewrite sur apache !!!!
a2enmod rewrite

Terminé, on relance apache:
/etc/init.d/apache2 restart

///////////////Pour le tutoriel d'instalation c'est terminé///////////// ouf... (merci de préciser si y a une coquille)

  • Phase 2 Demo live Wep sniffing avec airodump-ng et airtun-ng; décodage avec Xplico


Détail des commandes:

airmon-ng
airmon-ng start wlan1
airodump-ng -w /root/Bureau/s -c 11 --bssid 00:11:22:33:44:55 mon0

(airmon-ng pour passer a carte en monitor)
(airodump-ng pour enregistrer; -w "écrire" -c "canal" --bssid "@ mac de l'ap")

|-------------------------------------------------------------------

|--[3] Launch airtun-ng with the Wep key and mount your tun/tap at0

airtun-ng -a 00:11:22:33:44:55 -w 55:44:33:22:11 mon0
ifconfig at0 up

(airtun-ng -a "@mac ap" -w "clé wep" interface wifi)

|-------------------------------------------------------------------

|--[4] Hack Xplico

| a] enlevez /opt/xplico/xplico.db
| b] enlevez tous /opt/xplico/pol
| c] exec:
| cd /opt/xplico/script/db/sqlite2
| ./create_xplico_db.sh
| d] avec la web ui, réalisez une seul case
| c] dans cette case créez seulement une session d'écoute (sol) listening sessions
| ici /opt/xplico/script vous trouverez
| rt_demo.sh. éditez l'interface par la votre



cd /opt/xplico/script/ && ./sqlite_demo.sh
|#abort

|-------------------------------------------------------------------

|--[5] Run Xplico in live, 1337

cd /opt/xplico/script/ && ./rt_demo.sh


  • Phase 3 demo forensics sur un pcap avec xplico, airdecap-ng pour decrypter le Wep et décoder son contenu


Détail des commandes:

|--[1] First decrypt your wep packet

airdecap-ng -w 55:44:33:22:11 s-01.cap

(airdecap-ng -w "clé wep" "emplacement pcap"

|-------------------------------------------------------------------

|--[2] Run Xplico demo sqlite

cd /opt/xplico/script/ && ./sqlite_demo.sh

|-------------------------------------------------------------------

|--[3] Jump to the web ui, create case & sol, upload your pcap (*dec*)
http://127.0.0.1:9876
  • Phase 4 Xplico en cli (sans l'interface web)
On se place dans notre répertoire de binaire:

./xplico -m pcap -f s-01.cap

pour un dossier de pcap:

./xplico -m pcap -d ~/wardrive/

En temps reel sur eth0:

./xplico -m rltm -i eth0

Voila qui boucle le tuto sur xplico, site web: xplico


Troubleshotings : 

Activate the verbose mode. So, edit /opt/xplico/xi/app/config/core.php, look for

Code:
        Configure::write('debug', 0);

and change the value for '2'. Reload the web and tell us what outputs.


Installing THC-Hydra6.1 on Ubuntu 10.10 (Maverick Meerkat) with SSL support

Wikipedia describes THC-Hydra as “… software … that uses a dictionary attack to test for weak or simple passwords on one or many remote hosts running a variety of different services.” Its useful for doing quick tests against your servers to make sure that your users are not using simple passwords. In pen tester speak, this is called a brute-force attack.
Here are the steps needed for installing it on the 32-bit version of Ubuntu 10.10 (Maverick Meerkat).
Make sure you have all the necessary development tools (i.e. libraries, compilers, headers) and the source files for GTK:

sudo apt-get install build-essential linux-headers-$(uname -r) libgtk2.0-dev libssl-dev cmake

Before we compile Hydra, we need to install libssh. For some odd reason, hydra does not like the libssh-dev package that comes with Ubuntu.

wget -c http://www.libssh.org/files/0.4/libssh-0.4.6.tar.gz
tar -xvzf libssh-0.4.6.tar.gz
cd libssh-0.4.6
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
make
sudo make install
cd ../..
 
Download and extract the THC-Hydra tarball
 
wget -c http://edwincastillo.com/wp-content/uploads/2010/12/hydra-6.1-src.tar.gz
tar -xvzf hydra-6.1-src.tar.gz
cd hydra-6.1-src
 
Now you are ready to compile:
./configure
make
sudo make install
 
You are now ready to use Hydra. Type ./hydra -h to get syntax help. The GUI version can be started by running xhydra.
If you have a GMail account with IMAP enabled, you can use the following example to test hydra:
 
hydra -S -l email@gmail.com -p your_password -V imap.gmail.com imap

 
 

jeudi 20 janvier 2011

Capturing with dumpcap for viewing with Wireshark

Dumpcap is a network traffic dump tool. It captures packet data from a live network and writes the packets to a file. Dumpcap's native capture file format is libpcap format, which is also the format used by Wireshark, tcpdump and various other tools.
Without any options set it will use the pcap library to capture traffic from the first available network interface and write the received raw packet data, along with the packets' time stamps into a libpcap file.
Packet capturing is performed with the pcap library. The capture filter syntax follows the rules of the pcap library.



Example  Help information available from dumpcap
dumpcap -h
Dumpcap 1.4.0
Capture network packets and dump them into a libpcap file.
See http://www.wireshark.org for more information.

Usage: dumpcap [options] ...

Capture interface:
  -i <interface>           name or idx of interface (def: first non-loopback)
  -f <capture filter>      packet filter in libpcap filter syntax
  -s <snaplen>             packet snapshot length (def: 65535)
  -p                       don't capture in promiscuous mode
  -B <buffer size>         size of kernel buffer (def: 1MB)
  -y <link type>           link layer type (def: first appropriate)
  -D                       print list of interfaces and exit
  -L                       print list of link-layer types of iface and exit
  -S                       print statistics for each interface once every second
  -M                       for -D, -L, and -S produce machine-readable output

Stop conditions:
  -c <packet count>        stop after n packets (def: infinite)
  -a <autostop cond.> ...  duration:NUM - stop after NUM seconds
                           filesize:NUM - stop this file after NUM KB
                              files:NUM - stop after NUM files
Output (files):
  -w <filename>            name of file to save (def: tempfile)
  -b <ringbuffer opt.> ... duration:NUM - switch to next file after NUM secs
                           filesize:NUM - switch to next file after NUM KB
                              files:NUM - ringbuffer: replace after NUM files
  -n                       use pcapng format instead of pcap
Miscellaneous:
  -q                       don't report packet capture counts
  -v                       print version information and exit
  -h                       display this help and exit

Example: dumpcap -i eth0 -a duration:60 -w output.pcap
"Capture network packets from interface eth0 until 60s passed into output.pcap"

Use Ctrl-C to stop capturing at any time.
      

Capturing with tcpdump for viewing with Wireshark

There are occasions when you want to capture packets using tcpdump rather than wireshark, especially when you want to do a remote capture and do not want the network load associated with running Wireshark remotely (not to mention all the X traffic polluting your capture).
However, the default tcpdump parameters result in a capture file where each packet is truncated, because most versions of tcpdump, will, by default, only capture the first 68 or 96 bytes of each packet.
To ensure that you capture complete packets, use the following command:
 
tcpdump -i <interface> -s 65535 -w <some-file>
      
You will have to specify the correct interface and the name of a file to save into. In addition, you will have to terminate the capture with ^C when you believe you have captured enough packets.
[Note]Note!
tcpdump is not part of the Wireshark distribution. You can get it from: http://www.tcpdump.org for various platforms.

mardi 11 janvier 2011

Mediaroom Troubleshooting Tools: Client Trace Log Viewer

Mediaroom Troubleshooting Tools: Client Trace Log Viewer



Microsoft MediaroomDuring my previous blog posts we have discussed what Microsoft Mediaroom is and some of its features which help differentiate it from standard television providers. In my next set of posts we’ll discuss some of the tools that Mediaroom support personnel can use to troubleshoot various aspects of the Mediaroom environment. Over the last couple of months, I’ve had occasion to work with a customer that is new to the Mediaroom environment, and the one tool that we are constantly using is called the Client Trace Log Viewer, so I figured it would be a great place to start our Mediaroom tools discussions.
Often times, we are asked to investigate why end user set top boxes (STBs) are not performing as expected; slow performance, missing guide information, VOD playback, etc. All of these issues are visible to the end users eye but are hard to quantify without any real data from the components themselves, this is where the Client Trace Log Viewer (CTL Viewer) comes into play. In the next couple of sections we’ll discuss CTLs features and how to configure, view, and filter the captured events.

Features

The CTL Viewer allows support personnel to gather real-time debugging information from any STB in the Mediaroom environment. We can easily enable CTL viewing on any specific STB we choose. This ability to drill down to individual devices is particularly useful as often times end users have multiple units. Once CTL viewing is enabled, it changes the logging state of the STB and tells the device to start collecting trace logging of the actions it performs and to pass this information to the Mediaroom servers. Nothing is physically connected to the STB nor is there any additional tracing software needed (all logging is implemented server-side). This means that the operator can have multiple sinks and filters running without fear of performance impact.

Configuring Client Trace Log Viewer

The first step is to configure the CTL Viewer (generally the executable will be located in the Mediaroom Resource Kit)
  1. Run ClientTraceLogViewer.exe
  2. Select Connection > Open Serverlayout
  3. Navigate to the serverlayout.xml file (the path C:\Program Files\Microsoft IPTV Services\config\serverLayout.xml)
Mediaroom Client Trace Event Viewer

Enabling Logging

  1. From the Menu bar, select Connection > Set Client Log State
  2. You uniquely identify the STB using the external client ID. This information can found in the Branch SMT
  3. Select the length of time for the STB to log
  4. Click “Client Filter”. You can set up your filters based on the type of event as well as the severity of the event
  5. Click OK twice. Now select the “Start Retrieving Events” icon. The STB will begin logging the events and push them forward to the server
Mediaroom STB Logging Settings
6. To stop logging, select the “Stop Retrieving Events” icon from the Menu bar.
7. If you wish to save the events for future viewing, click the Save button from the Menu bar

Viewing Events

  1. If you saved the events as per Step 7 above, they can be viewed as a text file. Otherwise you can use the CTL Viewer to review the events captured
  2. Select Events > Retrieve Events
  3. Ensure the information in the Connect dialog box is correct and select OK
  4. If you wish to further filter the information, choose View > Options
  5. Select the Filters tab, filter based upon your needs
  6. In the CTL Viewer, all information in the left pane represents Web Service calls and TV2 events. The right pane is for logging message. If you select an individual message, the details will be presented Details pane in the bottom third of the viewer
Hopefully this overview gives you at least a basic understanding of the Client Trace Log Viewer and its usage. In the following months we’ll continue to investigate more troubleshooting tools and how they relate to Mediaroom. If you wish to learn more about the Mediaroom platform, please visit http://www.microsoft.com/Mediaroom/

Thansk to  Warren Johns from http://www.opsvault.com/mediaroom-troubleshooting-tools-client-trace-log-viewer/

jeudi 4 novembre 2010

Mode d'emploi tcpdump & tshark

  • TCPDUMP

Pour installer TcpDump sous Debian / Ubuntu :
sudo apt-get install tcpdump

Attention, pour utiliser TcpDump, il faut être root. Sous Ubuntu, il suffit de mettre sudo devant le nom de la commande. (sudo tcpdump ....)


Voici les lignes de commande que j'utilise pour TcpDump :

Pour capturer la totalité des paquets (-s 0 = illimité) :
# tcpdump -i eth0 -n -s 0 -w fichier.cap

Pour ne capturer que les 100 premiers octets de chaque paquets :
# tcpdump -i eth0 -n -s 100 -w fichier.cap

Pour capturer la totalité des paquets qui viennent de l'IP 192.168.1.1 et du port 5001 :
# tcpdump -i eth0 -n -s 0 -w fichier.cap host 192.168.1.1 and port 5001

Pour ne capturer que les 100 premiers octets de chaque paquets qui viennent de l'IP 192.168.1.1 et du port 5001 :
# tcpdump -i eth0 -n -s 100 -w fichier.cap host 192.168.1.1 and port 5001

Pour ne capturer que les paquets IGMP (en totalité) :
# tcpdump -i eth0 -n -s 0 -w fichier.cap igmp

Pour ne capturer qu'un certain nombre de paquets, rajouter l'option -c suivi du nombre de paquets
-c 10000 : 10 000 paquets vidéos UDP (MPEG2-TS) = 13,2 Mo
-c 100000 : 100 000 paquets vidéos UDP (MPEG2-TS) = 132,1 Mo

  • eth0 représente l'interface Ethernet sur laquelle je capture le trafic
  • fichier.cap le chemin/nom du fichier crée
  • -n = Ne pas convertir les adresses (comme l'IP, le port, ect...) vers des noms.

  • Tshark

Pour installer Tshark sous Windows :
Installer tout simplement wireshark

Pour installer Tshark sous Debian / Ubuntu :
sudo apt-get install tshark

Pour capturer la totalité des paquets et faire des fichier horodatés de 100 Mo sans limite :

Sous windows : "c:\Program Files\Wireshark\tshark.exe" -i 2 -b filesize:100000 -n -w c:\captures\fichier.cap
Sous linux : # tshark -b filesize:100000 -i eth0 -n -w fichier.cap

Créer un buffer circulaire de 10 fichiers de 100000 Mo :

Sous windows : "c:\Program Files\Wireshark\tshark.exe" -i 2 -b filesize:100000 -b files:10 -n -w c:\captures\fichier.cap
Sous linux : # tshark -b filesize:100000 -b files:10 -i eth0 -n -w fichier.cap

La capture change de fichier tous les 100 Mo et seuls les 10 derniers fichiers sont conservés.
Attention, si tshark est arrêté et redémarré, on a 10 nouveaux fichiers (les 10 de la précédente commande sont gardés indéfiniment)

Faire une capture de 100 Mo puis arrêter en affichant les statistiques RTP (perte de paquets) :

Sous windows : "c:\Program Files\Wireshark\tshark.exe" -i 2 -n -w test.cap -a filesize:100000 -z rtp,streams
Sous linux : # tshark -i eth0 -n -w test.cap -a filesize:100000 -z rtp,streams

# tshark -i eth0 -n -w test.cap -a filesize:100000 -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth4
73938 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 73879     0 (0.0%)            7.39            0.58            0.17
==============================================================


Faire une capture de 10 min puis arrêter en affichant les statistiques RTP (perte de paquets) :

Sous windows : "c:\Program Files\Wireshark\tshark.exe" -i 2 -n -w test.cap -a duration:600 -z rtp,streams
Sous linux : # tshark -i eth0 -n -w test.cap -a duration:600 -z rtp,streams


Vérifier les pertes de paquets du flux TV pendant 10minutes (statistiques RTP) :

Sous windows : "c:\Program Files\Wireshark\tshark.exe" -i 2 -a duration:600 -q -z rtp,streams
Sous linux : # tshark -i eth0 -a duration:600 -q -z rtp,streams

Code: 
# tshark -i eth0 -a duration:600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
141961 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 141656   639 (0.4%)          922.74            2.27            0.26 X
==============================================================

Ne pas afficher les paquets capturés (pour batch) : rajouter l'option -q

TAILLE DES PAQUETS CAPTURES :
modifier l'argument -s pour la taille de la capture : exemple -s 68 pour limiter a 68 octets (valeur min) ou -s 0 pour tout capturer

FILTRE DE CAPTURE
- Pour capturer la totalité des paquets qui viennent de l'IP 192.168.1.1 et du port 5001 :
=> tcpdump -i eth0 -n -s 0 -w fichier.cap host 192.168.1.1 and port 5001
- Pour ne capturer que les 100 premiers octets de chaque paquets qui viennent de l'IP 192.168.1.1 et du port 5001 :
 => tcpdump -i eth0 -n -s 100 -w fichier.cap host 192.168.1.1 and port 5001
- Pour ne capturer que les paquets IGMP (en totalité) :
 => tcpdump -i eth0 -n -s 0 -w fichier.cap igmp

DUREE DE LA CAPTURE :

L'argument -c fixe la durée de la capture a xxx paquets quel ques soit la taille des paquets.
Pour information, 30000 paquets représente 50 mo  avec des paquets de 1500 octets
Si on prend des petits paquets (VoIP par exemple) ou si on limite la taille de la capture, il est possible d'augmenter cette valeur par exemple à 300 000 pour une taille identique.

Code:
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync
/usr/bin/sudo /usr/bin/nice -n -10 /usr/bin/ionice -c1 /usr/sbin/tcpdump -i eth0 -n -s 0 -w /tmp/capture.cap host 87.88.221.5 or 89.80.250.70 and udp -c 90000 2> /tmp/drop_pendant_capture.txt

Pour arrêter proprement la capture si un script lance tcpdump en boucle : la commande a taper est : /usr/bin/sudo /usr/bin/killall -s INT tcpdump

Merci à Vivian du forum iperf

Conseils pour l'analyse avec Wireshark / TcpDump

Vous vous êtes peut etre intéressé à analyser votre trafic ?
En ADSL, l'utilisation de Wireshark (nouveau nom pour Ethereal) ne pose pas de problème particulier si votre PC est puissant.

En fibre optique avec des débits de 50 Mb/s ou 100 Mb/s Wireshark n'arrive pas à capturer tous les paquets.

Comment voir que l'on ne capture pas tous les paquets ?
Après avoir terminé la capture, vous avez "Drop : 0" qui s'affiche en abs de la fenetre wireshark.

Si c'est 0, c'est bon, aucun paquet na été ignoré. Si vous avez "Drop : 5473", vous avez 5473 paquets qui ne sont pas présents  :'(

Quelques suggestions :

  • Décocher la case "Update list of packets in real time" dans la fenetre d'option de capture
  • Ne pas mettre de filtre lors de la capture (ne pas utiliser les "read filters" ni les "capture filters")
  • Arrêter les programmes inutiles afin de libérer de la puissance CPU et de la RAM qui pourra "cacher" les écriturres disque
  • Pour les PC avec 2 disques dur, utiliser un disque pour le transfert http / ftp et un pour Wireshark (changer l'emplacement du fichier temporaire)
  • Windows uniquement : augmenter la tailler du buffer "Buffer size" dans la fenêtre d'option de capture
  • Si vous avez plusieurs carte réseau, tester avec un autre, elle ne consomme pas toute autant de CPU pour un même trafic


Si malgré ces conseils vous perdez encore des paquets, il reste encore 6 solutions a utiliser éventuellement ensemble :

- Réduire la taille des paquet capturé au strict minimum pour votre usage. Par exemple en n'enregistrant que les 100 premiers octets de chaque paquet contre plus de 1500 habituellement, vous limitez fortement les écriture sur le disque qui sont critique pour la perte de paquets lors de la capture.

- Si vous avez beaucoup de RAM, vous pouvez créer un RAMdisk ou vous demanderez à wireshark d'écrire son fichier. Un RAMdisk est un disque de quelques centaines de Mo qui va puiser l'espace en RAM (c'est donc d'accès immédiat avec un débit de plusieurs Go par seconde). Attention, la mémoire réservée au Ramdisk n´est plus utilisable comme mémoire vive centrale par votre systéme d'exploitation. Faite donc attention a laisser au moins 512 Mo à Windows XP / linux sans quoi il va swaper et la c'est la catastrophe pour la capture. (pour vista laissez 1 Go au système est un minimum)
Mode d'emploi pour crée un ramdisque : pour Windows / pour linux / Pour MacOS


- Utiliser un outil spécialisé dans la capture (Wireshark n'est pas optimiser la capture, pour ne pas avoir de perte, il est conseillé de passer par un outil qui fait de la capture uniquement, source : http://wiki.wireshark.org/Performance). Une fois la capture réalisée vous pourez l'ouvrir avec Wireshark pour apliquer vos filtres et analyser la trace. Ces outils sont :

- Sous linux prioriser l'application tcpdump :
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync

# Démarrage de la capture
/usr/bin/sudo /usr/bin/nice -n -10 /usr/bin/ionice -c1 /usr/sbin/tcpdump -i eth0 -n -s 0 -w $1/Capture.cap host 87.88.87.88 or 87.88.87.87 and udp -c 90000 2> $1/drop_pendant_capture.txt

Le fait de mettre /usr/bin/sudo /usr/bin/nice -n -10 devant la commande tcpdump priorise le CPU pour tcpdump
Le fait de mettre /usr/bin/sudo /usr/bin/ionice -c1 devant la commande tcpdump priorise l'accès disque pour tcpdump


- Utiliser un système d'exploitation Linux serveur : les OS en ligne de commande ont moins de taches faisant des accès au disque et créant des pertes de paquets.

- Sous linux supprimer la crontab afin de ne laisser que le process de capture :

sudo nano -w /etc/crontab => commenter les différentes lignes
sudo nano -w /etc/cron.d/anacron => commenter la ligne
sudo nano -w /etc/cron.d/update-motd => commenter les différentes lignes

Source : Vivien du forum iperf

Analyser les pertes de paquets UDP via un flux multicast RTP

Le concept :

De plus en plus de FAI mettent un couche supplémentaire pour les flux multicast (ceux qui transporte la TV) : RTP (Real-time Transport Protocol)



RTP rajoute 12 octets par paquet IP avec des informations d'horodatage et un n° de séquence. C'est ce dernier qui nous intéresse : il est incrémenté de un a chaque paquet : Cela nous permet de savoir si nous avons perdu des paquets.

Ce tuto a été testé avec les 3 FAI suivants :
- NeufBox de SFR
- Bbox de Bouygues Telecom
- ClubBox de Club-Internet

Il faut être abonné a l'offre TV pour que cela puisse fonctionner.

Nous allons utiliser VLC pour nous abonner aux flux multicast et Wireshark / Tshark pour analyser ces pertes de paquet.

Voici une liste de quelques IP multicast pour faire les tests :

IP multicast    port    Nom de la chaine TV             Débit IP     diffusion      Flux RTP disponible avec les Box
233.136.0.11665000ARTE SD MPEG42,47 Mb/sflux en clairNeufBox, Bbox de Bouygues Telecom
233.136.0.12765000I>Tele SD MPEG42,47 Mb/sflux en clairNeufBox, Bbox de Bouygues Telecom
233.60.197.864000I>Tele SD MPEG23,5 Mb/sflux en clairNeufBox, Bbox de Bouygues Telecom
233.49.82.737500TF1 HD MPEG4 adsl6,05 Mb/sflux cryptéNeufBox, Bbox de Bouygues Telecom
233.136.0.2017500France2 HD MPEG4 fibre optique12,28 Mb/sflux cryptéNeufBox fibre optique uniquement

Le plan de service complet de la NeufBox de SFR est consultable ici : http://lafibre.info/index.php/topic,3701.0.html


1ére étape : Installer VLC, Wireshark et Tshark.


2éme étape : Configurer Wireshark pour le RTP (Real-time Transport Protocol)

Pour Wireshark 1.0.7 (Ubuntu 9.04) :
1/ mkdir ~/.wireshark
2/ wget http://iperf.fr/download/wireshark/preferences.wireshark1.0.7-ubuntu9.04
3/ mv preferences.wireshark1.0.7-ubuntu9.04 ~/.wireshark/preferences
4/ wget http://iperf.fr/download/wireshark/disabled_protos.wireshark1.0.7-ubuntu9.04
5/ mv disabled_protos.wireshark1.0.7-ubuntu9.04 ~/.wireshark/disabled_protos

Pour Wireshark 1.0.3 (Ubuntu 8.10) :
1/ mkdir ~/.wireshark
2/ wget http://iperf.fr/download/wireshark/preferences.wireshark1.0.3-ubuntu8.10
3/ mv preferences.wireshark1.0.3-ubuntu8.10 ~/.wireshark/preferences
4/ wget http://iperf.fr/download/wireshark/disabled_protos.wireshark1.0.3-ubuntu8.10
5/ mv disabled_protos.wireshark1.0.3-ubuntu8.10 ~/.wireshark/disabled_protos


3éme étape : S'abonner au flux multicast avec VLC

cvlc rtp://@233.136.0.116


4éme étape : Lancer la capture + analyse temps réel avec Tshark

Lancer dans un autre terminal sans fermer la commande VLC :
sudo tshark -i eth0 -n -s 68 -w /tmp/capture_temporaire.cap -a duration:600 -z rtp,streams

A la fin de la capture il suffit de quitter VLC "CTRL" + "C" pour se dé-abonner du flux multicast



Voici un script pour lancer la capture depuis la Crontab en permanence :

#!/bin/bash
####################################################################################
# SYNOPSIS : est appelé depuis la crontab - pas d'options                          #
#                                                                                  #
# DESCRIPTION :                                                                    #
#   Fait une capture pendant 59minutes et 50 secondes                              #
#                                                                                  #
# DEPENDANCES :                                                                    #
#   /bin/bash                                                                      #
#   /bin/date                                                                      #
#   /bin/sync                                                                      #
#   /bin/rm                                                                        #
#   /usr/sbin/ntpdate                                                              #
#   /usr/bin/tshark                                                                #
#   /usr/bin/cvlc                                                                  #
#   /usr/bin/killall                                                               #
#   /usr/bin/sudo                                                                  #
#                                                                                  #
####################################################################################

# abonnement au flux
/usr/bin/sudo -u vgu /usr/bin/cvlc rtp://@233.49.82.73 &
# date de début de capture
/bin/date >> /root/capture.txt
# Capture avec Tshark
/usr/bin/tshark -i eth0 -n -s 68 -w /tmp/ramdisk0/capture_temporaire.cap -a duration:175 -z rtp,streams >> /root/capture.txt
# désabonnement du flux
/usr/bin/killall vlc
# Supressions des fichiers et sync pour ne pas avoir une grosse écriture qui fait perdre des paquets au début du tcpdump
/bin/rm /tmp/ramdisk0/capture_temporaire.cap
# MISE A L'HEURE (la mise à l'heure ne soit pas se faire pendant la capture)
/usr/sbin/ntpdate 194.158.119.97 >> /root/ntpdate.vg.log
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync
# date de fin de capture
/bin/date >> /root/capture.txt
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync

Le rendre exécutable : sudo chmod +x capture.sh

Pour mettre les préférence wireshark (2éme étape), il faut se connecter en root avec sudo -i pour avoir les variables environnement du root

La ligne a mettre dans la crontab :
lancement toutes les 3min : 0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,48,51,54,57 * * * * /root/capture.sh
lancement toutes les 4min : 0,4,8,12,16,20,24,28,32,36,40,44,48,52,56 * * * * /root/capture.sh


#!/bin/bash
####################################################################################
# SYNOPSIS : est appelé depuis la crontab - pas d'options                          #
#                                                                                  #
# DESCRIPTION :                                                                    #
#   Fait une capture pendant 59minutes et 50 secondes                              #
#                                                                                  #
# DEPENDANCES :                                                                    #
#   /bin/bash                                                                      #
#   /bin/date                                                                      #
#   /bin/sync                                                                      #
#   /bin/rm                                                                        #
#   /usr/sbin/ntpdate                                                              #
#   /usr/sbin/tcpdump                                                              #
#   /usr/bin/tshark                                                                #
#   /usr/bin/cvlc                                                                  #
#   /usr/bin/killall                                                               #
#   /usr/bin/sudo                                                                  #
#   /usr/bin/sleep                                                                 #
#                                                                                  #
####################################################################################

# abonnement au flux
/usr/bin/sudo -u vgu /usr/bin/cvlc rtp://@233.49.82.73 &
# date de début de capture
/bin/date >> /root/capture.txt
# Capture avec TCPdump
/usr/sbin/tcpdump -i eth0 -n -s 68 -w /tmp/ramdisk0/capture_temporaire.cap host 233.49.82.73 &
/bin/sleep 3550
/usr/bin/killall -s INT tcpdump
# désabonnement du flux
/usr/bin/killall -s INT vlc
# Post-traitement avec Tshark
/usr/bin/tshark -n -r /tmp/ramdisk0/capture_temporaire.cap -q -z rtp,streams >> /root/capture.txt
# Supressions des fichiers et sync pour ne pas avoir une grosse écriture qui fait perdre des paquets au début du tcpdump
/bin/rm /tmp/ramdisk0/capture_temporaire.cap
# MISE A L'HEURE (la mise à l'heure ne soit pas se faire pendant la capture)
/usr/sbin/ntpdate 194.158.119.97 >> /root/ntpdate.vg.log
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync
# date de fin de capture
/bin/date >> /root/capture.txt
# Ecriture du cache sur le disque pour que dump ne se produise pas pendant l'écriture
/bin/sync


1ére étape : Installer VLC et Wireshark qui sont 2 logiciels libres.

En graphique sous Ubuntu, allez dans me menu Applications => Ajouter / supprimer... sélectionner "Afficher toutes les applications disponibles" et recherchez VLC et Wireshark.

Pour faire l'installation en ligne de commande :
sudo aptitude install vlc wireshark


 2éme étape : Configurer Wireshark pour le RTP (Real-time Transport Protocol)
Démarrez Wireshark.
Allez dans le menu Edit => Preferences...


Cliquez sur la petite flèche à gauche de Protocols


Cherchez RTP dans le bas de la liste (c'est par ordre alphabétique)
Cochez la 2éme case comme montré ci-dessous :

Cliquez sur Valider.

A partir de maintenant Wireshark et Tshark sont capable de décoder le protocole RTP

3éme étape : S'abonner au flux multicast avec VLC

Via une ligne de commande il suffit d'entrer la ligne suivante dans un terminal :
cvlc rtp://@233.136.0.116


Via l'interface graphique de VLC cela se fait en 3 étapes :








L'interface a utiliser est la première dans la liste qui a des paquets qui s'incrémente régulièrement. En Ethernet généralement c'est eth0





La capture temporaire (avant enregistrement) est réalisée dans /tmp
4éme étape : Lancer la capture avec Wireshark

5éme étape : Analyser la capture avec Wireshark

Aller dans le menu Telephony puis RTP et enfin Show All Streams





Exemples de résultats :

Pas bon :
# tshark -i eth3 -a duration:600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth3
142323 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 141011  1464 (1.0%)         4127.30            1.13            0.24 X
==============================================================

# tshark -i eth3 -a duration:600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth3
141168 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 141068  1283 (0.9%)         5394.35            0.46            0.24 X
==============================================================

Parfait :
# tshark -i eth0 -a duration:600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
142342 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 142269     0 (0.0%)            4.31            0.03            0.02
==============================================================

# tshark -i eth0 -a duration:600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
142430 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 142352     0 (0.0%)            4.30            0.03            0.02
==============================================================

Modem Dlink :
root@bt8silq2:~# tshark -i eth0 -a duration:3600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
855204 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 854739     0 (0.0%)            4.31            0.03            0.02
==============================================================


root@vivien:~# tshark -i eth0 -a duration:3600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
915734 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0x1324FE6A MPEG-II transport streams 845987  8675 (1.0%)         8102.02            0.48            0.12 X
==============================================================

Modem TG787 20min :
root@bt8silq2:~# tshark -i eth0 -a duration:1200 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
285038 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 284895     0 (0.0%)            4.31            0.51            0.01
==============================================================

root@vivien:~# tshark -i eth0 -a duration:1200 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
284856 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 257782 27010 (9.5%)        45797.12            0.65            0.27 X
==============================================================

Modem TG787 20min :
root@bt8silq2:~# tshark -i eth0 -a duration:1200 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
285087 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 284901     0 (0.0%)            4.33            0.83            0.01
==============================================================

root@vivien:~# tshark -i eth0 -a duration:1200 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
287700 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 262157 22702 (8.0%)        31113.13            0.68            0.27 X
==============================================================

Modem TG787 60min :
root@bt8silq2:~# tshark -i eth0 -a duration:3600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
749068 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 748642     0 (0.0%)            4.32            1.24            0.01
==============================================================

root@vivien:~# tshark -i eth0 -a duration:3600 -q -z rtp,streams
Running as user "root" and group "root". This could be dangerous.
Capturing on eth0
903653 packets captured
========================= RTP Streams ========================
    Src IP addr  Port    Dest IP addr  Port       SSRC          Payload  Pkts         Lost   Max Delta(ms)  Max Jitter(ms) Mean Jitter(ms) Problems?
  84.96.146.150  5000   233.136.0.116 65000 0xB2D9803F MPEG-II transport streams 826094 28748 (3.4%)        48968.63            0.85            0.27 X
==============================================================