středa 8. února 2017

Capturing SIP and RTP traffic and saving it to pcap file

tcpdump -i eth0 udp port 5060 or udp portrange 10000-20000 -s 0 -w filename.cap

středa 20. července 2016

DISKPART quick how-to

Run cmd in Windows "As Administrator"

LIST DISK

SELECT DISK 5 (or another number)

CLEAN

Now you can create a new partition table.

úterý 28. června 2016

How to set up Linux system proxy

Type the following command to set proxy server:

export http_proxy=http://server-ip:port/
export http_proxy=http://127.0.0.1:3128/
export http_proxy=http://proxyserver.org:3128/
For https:
export http_proxy=http://server-ip:port/

 Set system proxy permanently to all system users: 

Write the previous lines into /etc/enviroment

vim /etc/enviroment

 

středa 24. června 2015

How to identify a script sending spam through Postfix

How (step by step):
  • Switch to a user with sudo rights
  • Check the mail queue with command mailq
  • The first column of the mail queue list shows unique mail ID's, pick one from an obvious spam email and copy it
  • Check this email's details with command postcat -q using the unique mail ID you copied in place of
  • Identify the line starting with "X-PHP-Originating-Script". This should show which script is generating the spam emails
  • Remove the script, patch the website with latest security fixes and make sure folder and file permissions are secure
  • Empty the mail queue with command postsuper -d ALL
  • Check the mail queue again with command mailq to see if more emails are now generated. If the problem persists, repeat the above steps and see if you find other scripts causing you problems.
Source: http://frontmag.no/artikler/how-identify-script-sending-spam-through-postfix

úterý 17. února 2015

Disable IPv6 in Ubuntu

Good when you don`t know much about stuff and don`t know how to configure IPv6 firewall.

Edit /etc/sysctl.conf

Paste to the end:

net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1

Run sysctl -p

After that if you check,

$ cat /proc/sys/net/ipv6/conf/all/disable_ipv6

You will get result as,

1

If you get result as 1, ipv6 disabled successfully.

Install MySQL Server in Ubuntu Without a Password prompt

debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password password rootpass'

debconf-set-selections <<< 'mysql-server-5.5 mysql-server/root_password_again password rootpass'

apt-get update

apt-get -y install mysql-server-5.5

úterý 29. července 2014

Windows XP update registry hack

Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\WPA\PosReady] "Installed"=dword:00000001

čtvrtek 23. ledna 2014

One hour SIP dumps

tcpdump -nq -s 0 -i any -G3600 -w /tmp/trace/sip-%F--%H-%M-%S.pcap port 5060

Re-enable MDRAID

mdadm –assemble –scan

ssh-agent how-to


#!/bin/bash

ssh-agent
ssh-add /home/user/key

čtvrtek 27. září 2012

GPSD debugging

gpsd -n -N -D4 /dev/ttyUSB0

Linux router iptables quick how-to

# Delete old configuration, if any
# Flush all the rules in filter and nat tables

iptables --flush

iptables --table nat --flush

# Delete all chains that are not in default filter and nat table, if any

iptables --delete-chain
iptables --table nat --delete-chain


# Set up IP FORWARDing and Masquerading (NAT)
# Interface with internet connection

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE

# Interface with nat-ed clients

iptables --append FORWARD --in-interface eth1 -j ACCEPT

#enable IP forwarding

echo 1 > /proc/sys/net/ipv4/ip_forward

Early Asterisk 1.8 SIP TLS problem

I wonder why Asterisk (1.8.3.3) when I configured it properly still didn`t run on TLS port 5061 without any error in logs. So if you are running Debian, install these packages by aptitude and then recompile Asterisk.
openssl libcrypt-dev libxcrypt-dev libcrypto++-dev libssl libssl-dev

How to alter MySQL procedure Security_type

ALTER PROCEDURE database.procedure_name SQL SECURITY INVOKER; and check:
SHOW PROCEDURE STATUS LIKE 'procedure_name';

How to use ngrep to capture SIP packets

It`s easy. With natural line breaks:

ngrep -W byline -d eth0 port 5060

To file:

ngrep -W byline -d eth0 port 5060 -O capture_file

Just INVITEs:

ngrep -W byline -d eth0 INVITE

Icinga monitoring how to

Icinga is a Nagios fork and still use Nagios plugins and NRPE/NSCA for distant monitoring. Let see how to make it work on Debian machine.  

1. Prepare
/usr/sbin/useradd -m icinga passwd icinga /usr/sbin/groupadd icinga /usr/sbin/groupadd icinga-cmd /usr/sbin/usermod -a -G icinga-cmd icinga /usr/sbin/usermod -a -G icinga-cmd www-data
2. Download from Sourceforge: http://sourceforge.net/projects/icinga/
tar xvzf icinga-x.tar.gz
./configure --with-command-group=icinga-cmd

How to ACL`s on Linux

aptitude install acl  
mount -o remount,acl /dev/hda3  
setfacl -R -m u:user:rwx /var/tmp/file  
setfacl -R -m g:group:rwx /var/tmp/file
 
“-R” is recursive. To see ACL rights just write

getfacl /var/tmp/file

And you`ll see something like this:

# file: var/tmp/file # owner: group # group: group user::rwx user:user:rwx group::rw- group:group:rwx mask::rwx other::---

And next you can add more users/groups rights to this file ;-)

How to sshfs

Almost like scp, or rsync syntax.
sshfs user@host:/path/to /local/path
And obviously if it isn`t working :)
modprobe fuse

středa 18. srpna 2010

SIP over TCP in Asterisk

Do sip.conf treba:

tcpenable=yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)


Do users.conf pre jednotliveho uzivatela, pripadne globalne do sip.conf treba:

[6000]
...
transport=tcp
...

úterý 3. srpna 2010

iLBC & SPEEX kodek na Asterisku

Kodeky s ktorymi som experimentoval hlavne koli potrebe co najmensieho datoveho toku pri telefonovani cez 3G siete.

Instalacia iLBC kodeku

Od 1.6 verzie Asterisku nie je iLbc standartnou vybavou, treba stiahnut rucne.. Asterisk ma na to vsak pripraveny script, kde po odsuhlaseni licencie stiahne vsetko potrebne:
cd /usr/src/asterisk-*/
./contrib/scripts/get_ilbc_source.sh
./configure
make menuconfig (vybrat iLbc v codecs sekcii)
make install

Nasledne treba povolit codec bud globalne v sip.conf, alebo pre kazdeho uzivatela zvlast:
disallow=all
allow=ilbc
allow=dalsikodek

A nakoniec kontrola:
asterisk -vvvvvvvvvvvvvr
load codec_ilbc.so
core show codecs
core show translations

Odkazy pre iLBC:

http://www.voip-info.org/wiki/view/iLBC

http://blogs.elastix.org/en/2009/11/ilbc-vs-g729-the-quick-guide-to-using-compressed-codecs-in-elastix/

Instalacia SPEEX kodeku
Na Debiane napiseme nasledovne:

aptitude install speex libspeex-dev
Potom je potrebne skompilovat Asterisk. Najprv spustime ./configure a nasledne v menuconfig oznacime podporu kodeku SPEEX v sekcii Codec Translators. Nasleduje obligatne make a make install.

V pripade,ze uz mame Asterisk skompilovany a kodek chceme pridat, musime spustit make distclean, aby sme Asteriska prinutili si podporu SPEEX natiahnut.

V pripade potreby rucnej kompilacie kodeku, je potrebne stiahnut si zdrojaky z adresy:
http://downloads.us.xiph.org/releases/speex/