aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: changement automatique du port TCP  (Read 3563 times)

stef72

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 6
changement automatique du port TCP
« on: September 12, 2004, 06:23:21 PM »

Serait il possible de changer  automatiquement a chaque demarrage le port TCP?
Car depuis un moment deja les FAI brident les ports connus pour etre utiliser pa'r les logiciels P2P.
Logged

benco

  • Approved Newbie
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 14
  • blablabla strasbourgeois
Re: changement automatique du port TCP
« Reply #1 on: September 12, 2004, 06:49:47 PM »

ce qui serait cool ce serait de pouvoir paramètrer 5 tcp différent et amule switcherait automatiquement sur ces ports comme ça on ouvre les correspodants sur le routeur et hop
Logged
Benco

thepolish

  • Hero Member
  • *****
  • Karma: 2
  • Offline Offline
  • Posts: 908
Re: changement automatique du port TCP
« Reply #2 on: September 12, 2004, 07:43:09 PM »

Tu px faire ca "a la main" :)

Les ports sont dans les lignes

Port=xxx
UDPPort=xxxx

du fichier ~/.eMule

Fait un script qui change ces lignes et lance amule APRES.

Thepolish
Logged
Only after the last tree has been cut down
Only after the last river has been poisoned
Only after the last fish has been caught
Only then you will find out that money cannot be eaten
(Cree Prophecy)

thepolish

  • Hero Member
  • *****
  • Karma: 2
  • Offline Offline
  • Posts: 908
Re: changement automatique du port TCP
« Reply #3 on: September 13, 2004, 11:46:08 PM »

Ok, un script perl qui change les ports au démarrage en en prnant un au hasard dans un pool (tous ces ports doivent etre ouverts dans le firewall):

Code: [Select]
#!/usr/bin/perl

use strict;
use Config::IniFiles;

#--------------------------------------------------------
# Parameters: Edit them to fit to your box
#--------------------------------------------------------

my $eMuleConfigPath = "/home/login/.eMule";
my $aMulePath = "amule &";

my @TCPPool = (1234,4565,7892,87541,8282);
my @UDPPool = (1254,4585,7891,87741,8382);

#--------------------------------------------------------
# Do not edit below unless you know what you are doing
#--------------------------------------------------------

# Reading old configuration
my $cfg = new Config::IniFiles -file => $eMuleConfigPath;

my $portTCP = $cfg->val('eMule', 'Port');
my $portUDP = $cfg->val('eMule', 'UDPPort');

print "Current TCP Port: $portTCP, Current UDP Port: $portUDP\n";

# Generating new ports
srand; # not needed for 5.004 and later

# New TCP Port
my $index   = rand @TCPPool;
my $newTCPPort = $TCPPool[$index];

# New UDP Port
$index   = rand @UDPPool;
my $newUDPPort = $UDPPool[$index];

print "New TCP Port: $newTCPPort, New UDP Port: $newUDPPort\n";

# Setting new ports
$cfg->setval ('eMule', 'Port', $newTCPPort);
$cfg->setval ('eMule', 'UDPPort', $newUDPPort);

# Writing file
$cfg->RewriteConfig();

# Lauching aMule
exec ($aMulePath);

- Installer le package perl Config::IniFiles
- copier dans pamule.pl && chmod 755 pamule.pl
- Editer #Parameters
- et hop, ./pamule.pl pour lancer amule

Thepolish
Logged
Only after the last tree has been cut down
Only after the last river has been poisoned
Only after the last fish has been caught
Only then you will find out that money cannot be eaten
(Cree Prophecy)