Posts Tagged ‘Linux’

mercurial-server on Fedora/Centos

November 2nd, 2009

If you want to setup mercurial-server on fedora or centos/rhel server you are going to see lots of failure messages during installation and the installation will definitely fail.

Mercurial-server was written to run smoothly on debian-based systems, so I patched it to run on fedora/centos and I would like to share the patch with you.

Using the patch is straight-forward, simply download the tip or the latest version of mercurial-server and put the patch file into the extracted directory.

patch < mercurial-server-centos.patch

the patch is a few lines, so it’s naive for professionals.

Get the patch from here

Have Fun.

Screen Tricks

September 14th, 2009

If you are using the famous ‘screen‘ command and you are using ‘windows‘ in screen alot then you might find it pretty useful to add the following lines in either your /etc/screenrc or ~/.screenrc file.

hardstatus alwayslastline
hardstatus string ‘%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]‘
shelltitle “$ |bash”
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
shelltitle "$ |bash"

This will add a very useful bar in the bottom of the screen where you can see in which window you are working and the process running and some other useful stuff.

Special thanks goes to Ahmed Kamal for the tip.

Etisalat USB Modem on Fedora 11

July 12th, 2009

This is how to get Etisalat USB modem working on Fedora 11.

“Etisalat Masr” new USB modem that supports HSDPA is based on Huawei E1550 USB Flip-Flop stick, so you need to get usb_modeswitch first to be able to switch the device from being a storage usb device to USB modem mode and this can be done easily by:

yum install usb_modeswitch

Then you need to add the following to the configuration file /etc/usb_modeswitch.conf  (add the following in the end of the file)

# Huawei E1550
DefaultVendor = 0x12d1
DefaultProduct = 0x1446
MessageEndpoint = 0x01
MessageContent = "55534243000000000000000000000011060000000000000000000000000000"

I got those information by sniffing USB on windows and you don’t have to do that because probably your MessageContent is the same as mine if the device is the same as mine and you can check if things are working or not by running

lsusb

and you will see a line like that

 ID 12d1:1446 Huawei Technologies Co., Ltd.

and then run

usb_modeswitch

you should see output like


* usb_modeswitch: tool for controlling "flip flop" mode USB devices
* Version 0.9.6 (C) Josua Dietze 2009
* Works with libusb 0.1.12 and probably other versions

Looking for default devices
Found default devices (1)
Prepare switching, accessing latest device
Looking for active default driver to detach it
OK, driver found ("usb-storage")
OK, Driver "usb-storage" successfully detached
Setting up communication with device
Trying to send the message
OK, message successfully sent.
-> See /proc/bus/usb/devices (or call lsusb) for changes. Bye

and please note that usb_modeswitch MUST be run as root, otherwise you will get an error.

if you got a message like the previous one then you can use the device directly from NetworkManager and you can check if the device has switched or not from the output of lsusb, it should be something like that now:

ID 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem

Have Fun :)

Fedora Ambassador in Egypt

June 5th, 2009

Assalamu A’alaykum everyone,

I’ve been accepted to be Fedora Ambassador in Egypt to help spreading the Linux knowledge and to assist communities to create events to promote Fedora and its projects in Egypt and in the region.
Please check my profile and don’t hesitate to contact me if you need a speaker in any Linux/Fedora related event or if you needed help in anything fedora in general.

Talk to GTalk from Python

April 27th, 2009

Some friend of mine asked me today if I can help him to communicate with google talk from python as he wants to send notifications about some network usage over the chat service. In fact, that was pretty interesting and it just inspired me with tons and zillions of ideas that you can do with that, things like getting security alters, usage logs, any simply feedback that you want to receive while being online and without being irritated with the fact that you have to refresh what you are monitoring every while.

It’s not a hard trick at all, but looks like all of the scripts on the internet are written wrong! and he have been trying to use all of them with no luck, so I helped him as I have some good experience with python-xmpp (xmpppy) module in python.

The idea is that we want to send a message to a Google Apps. User and use another account on the same domain to chat and here comes the trick about it and of course this script is released under the BSD License so you can do whatever you want to do with it :)

import xmpp

client = xmpp.Client('ahmedsoliman.com')
client.connect(server=('<a href="http://talk.google.com/" target="_blank">talk.google.com</a>', 5222))
client.auth(user='myUser', password='myPassword', resource='myResource', sasl=0)

client.send( xmpp.Message('anotherUser@ahmedsoliman.com', 'Hello World'))

Of course you can download the python-xmpp package manually or if you are using fedora, simply use the magical yum install python-xmpp

AntiNetCut v2

August 13th, 2008

At last, I’m very happy to announce the release of the long-waited Anti NetCut version2.

Main Features:

  1. Works on Ubuntu/Fedora/RHEL..
  2. Written in Python so it’s easy to maintain and update.
  3. Automatic detection of almost everything (you might need to supply the interface name as illustrated below)
  4. Works perfectly with NetCut 2.8…

The usage instructions are too easy, just download and edit the antinetcut.py file (change “device=eth0″) to your interface name and run the script…


Notes

  • You must leave the script running in the background, stopping the script means that you might get attacked again.
  • After starting the script, it might take a few seconds before you get your connection back, so please be patient.

Anyone wants to join development, please see the official page http://code.google.com/p/antinetcut/

Download from here: Download Here

Good Backup script

June 14th, 2008

I’ve a local home server that works as a local RAID storage with some virtual machines that serve different services to me and to some friends. The most known service to most of you is the XMPP service for chat.cat-hackers.net that enables all the H4ck3rZ Foundation members to communicate in an efficient way.

Another thing is that this server hold all of my important data that represents my own work throughout the years, so it’s very important to keep them secure and safe. I’d a bad experience of losing a 2.5GB harddrive that had all of my programming work. That experience taught me how to spend more money to keep your data safe and secure.

So :) I got an external 500GB USB hard drive to have it mainly as a backup drive for my 500GB RAID local home server, and as you can see it’s 500GB too, so I can’t do incremental backups on that disk because it too small for such a plan, so I decided to rsync the data on the storage server to the USB hard drive and I wrote a nice script that does some smart stuff….

Let’s post the script first then I’ll describe more about it.. » Read more: Good Backup script

Internet Connectivity Monitor Script

November 26th, 2007

I was assigned to monitor the link status here in the company because we had many problems regarding our new TEData internet line. We couldn’t calculate exactly when the line is down and up, so I wrote a small script to run as a cronjob to create a log for the internet connectivity status.

The script is quite useful and very light, it’ll generate a log about your internet connectivity and will try to detect the reason of the internet connectivity problems.

Note: you’ll need to change the value of the variable GATEWAY_IP to your gateway/router/dsl_modem IP address before running the script. And you don’t have to be root to run this script.

you can download it from this link

Fedora 8 Test Drive

November 15th, 2007

A few days ago I got a brand new Fedora 8 on a DVD iso and I was too excited to have a setup on my laptop. In fact I didn’t install Fedora 7 because I always felt that it doesn’t have much to add, wasn’t that stable too and it had one famous problem regarding firewire and video capturing.

starting from the installation, it was smooth and sexy, I’ve added the additional repository and chose alot of my preferred packages.

After Installation it was pretty sleek on GNOME and pretty UGLY! on KDE!, it seems that fedora developers insist convincing me of using GNOME so I said I’ll go for GNOME for awhile and see.

» Read more: Fedora 8 Test Drive

Linux Anti Netcut V0.2

June 1st, 2007

The famous ARP Poisoning problem started to spread here in egypt and while we are putting the main problems an engineer or specifically an egyptian engineer may face, we found that Netcut problem is one of the major ;)

I’ve developed a small script to magically terminate this issue, this is an Intelligent Anti netcut script, it has the following main features:

  1. Support for Multiple Interfaces and auto-detection of the correct interface
  2. Detection of poisoning or weird settings.
  3. Doesn’t need to be run continuously, run it once each 1 minute or even every 1 hour. [Typically, you'll need to run this script once!]
  4. Smart detection of Gateway Settings
  5. Verbose

You can download it directly from here http://www.ahmedsoliman.com/download-manager.php?id=1

NOTE: I’m not responsible for any damage you may have or face or any diseases that might spread or pets that might be killed in an area of half of the universe per using this script :D

UPDATE

This version is pretty old, if you want the latest version please check http://code.google.com/p/antinetcut

Waiting for feedback…