Wednesday, August 27, 2008

How to Download mms:// (MultiMedia Stream) Video?

If you are not able to download the mms://a-web-site/stream_video.wmv
and only able to play via streaming. But you might have slow speed,

Then, you can use mencoder to download above file.

$ mencoder -oac copy -ovc copy -o out_video_file.wmv mms://a-web-site/stream_video.wmv

PS. If you want to view via streaming, you can use mplayer:

$ mplayer mms://a-web-site/stream_video.wmv

Friday, August 22, 2008

Denial of Service (DoS) Prevention

You can prevent DoS on you machine, by running following
commands as root user. Or you can put following lines
in a shell script and run it as root.

# shut some DoS stuff down
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts

# increase the local port range
echo 1024 65535 > /proc/sys/net/ipv4/ip_local_port_range

# increase the SYN backlog queue
echo 2048 > /proc/sys/net/ipv4/tcp_max_syn_backlog

echo 0 > /proc/sys/net/ipv4/tcp_sack
echo 0 > /proc/sys/net/ipv4/tcp_timestamps

Wednesday, August 6, 2008

How to stop certain network to start at boot time in Fedora?

For example, if you do not want wlan0 to be started at boot time,
just move ifcfg-wlan0 file from /etc/sysconfig/network-scripts/ directory
to any other directory.

I am telling not to remove the file, because you can start
wlan0 interface after copying the file back to /etc/sysconfig/network-scripts/
whenever you want. And give command

# service network restart

Friday, August 1, 2008

Fixing tsocks 1.8 Beta

I was trying to use tsocks 1.8 beta5 on Fedora 8. After installing
I was able to use it. But, on next day, what I found is: I was not
able to access any website, messenger service. Although, I was
able to ping websites. Then I realized the tsocks is interfering
with direct connection to Internet. I was not using ssh tunnel at
that moment.

I have created patch for Makefile and tsocks script.

$ vi patch_Makefile

5c5

< prefix=/usr

---

> prefix=/usr/local

9c9

< libdir = /lib

---

> libdir = ${prefix}/lib

31c31

< CFLAGS = -g -O2 -Wall

---

> CFLAGS = -O3 -Wall



$ vi patch_tsocks
6c6

< # /usr/bin/tsocks program [program arguments...]

---

> # $PREFIX/bin/tsocks program [program arguments...]

13c13

< # /usr/bin/tsocks telnet www.foo.org

---

> # $PREFIX/bin/tsocks telnet www.foo.org

20c20

< # . /usr/bin/tsocks on

---

> # . $PREFIX/bin/tsocks on

22c22

< # . /usr/bin/tsocks off

---

> # . $PREFIX/bin/tsocks off

26c26

< # source /usr/bin/tsocks on

---

> # source $PREFIX/bin/tsocks on

28c28

< # source /usr/bin/tsocks off

---

> # source $PREFIX/bin/tsocks off

33c33

< # /usr/bin/tsocks

---

> # $PREFIX/bin/tsocks

39a40,41

> PREFIX="/usr/local"

>

49c51

< export LD_PRELOAD="/usr/lib/libtsocks.so"

---

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so"

51,52c53,54

< echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \

< export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"

---

> echo $LD_PRELOAD | grep -q "$PREFIX/lib/libtsocks\.so" || \

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so $LD_PRELOAD"

56c58

< export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\/usr\/lib\/libtsocks.so \?//'`

---

> export LD_PRELOAD=`echo -n $LD_PRELOAD | sed 's/\$PREFIX\/lib\/libtsocks.so \?//'`

71c73

< export LD_PRELOAD="/usr/lib/libtsocks.so"

---

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so"

73,74c75,76

< echo $LD_PRELOAD | grep -q "/usr/lib/libtsocks\.so" || \

< export LD_PRELOAD="/usr/lib/libtsocks.so $LD_PRELOAD"

---

> echo $LD_PRELOAD | grep -q "$PREFIX/lib/libtsocks\.so" || \

> export LD_PRELOAD="$PREFIX/lib/libtsocks.so $LD_PRELOAD"


How to apply patch and install tsocks?

$ tar -zxvf tsocks-1.8beta5.tar.gz


$ cd tsocks-1.8


$ ./configure


$ patch Makefile < patch_Makefile

$ patch tsocks < patch_tsocks


$ make


$ sudo make install


PS: If you do not find patches working, please mail me
at mitesh[dot]singh[dot]jat[at]gmail[dot]com . I will
send both patches to you.