English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés
Σ: 1 post

TCH  (statz) Főfasz
#1, Főfasz (10443)
2440 | #4671 | ^ | Idézet | Sat, 14 Oct 2017 22:23:29 +02
94.21.*.* Linux x86 Opera Classic Hungary *.pool.digikabel.hu
unit unix_iph;

interface

type
	ip_address = array[0..3] of string;
	pip_address = ^ip_address;

procedure normalize_ip(ip: pip_address);
procedure set_ip_data(address: ip_address; netmask: ip_address; gateway: ip_address);
procedure get_ip_data(out address: ip_address; out netmask: ip_address; out gateway: ip_address);

implementation

uses SysUtils, StrUtils;

procedure normalize_ip(ip: pip_address);
var i: integer;
begin
	if (not trystrtoint(ip^[0], i)) then ip^[0] := '0';
	if (not trystrtoint(ip^[1], i)) then ip^[1] := '0';
	if (not trystrtoint(ip^[2], i)) then ip^[2] := '0';
	if (not trystrtoint(ip^[3], i)) then ip^[3] := '0';
end;

function set_ip(ip: ip_address): string;
begin
	result := ip[0] + '.' + ip[1] + '.' + ip[2] + '.' + ip[3];
end;

procedure set_ip_data(address: ip_address; netmask: ip_address; gateway: ip_address);
var
	tf: textfile;
begin
	assignfile(tf, '/etc/network/interfaces');
	rewrite(tf);
	writeln(tf, 'iface eth0 inet static');
	write(tf, '	address ');
	writeln(tf, set_ip(address));
	write(tf, '	netmask ');
	writeln(tf, set_ip(netmask));
	write(tf, '	gateway ');
	writeln(tf, set_ip(gateway));
	closefile(tf);
	SysUtils.ExecuteProcess('/etc/init.d/networking', 'restart', []);
end;

function get_ip(s: string): ip_address;
var
   i, j: integer;
begin
	result[0] := '';
	result[1] := '';
	result[2] := '';
	result[3] := '';
	j := 0;
	for i := 1 to length(s) do
	begin
		if (s[i] = '.') then
		begin
			j := j + 1;
			if (j > 3) then
			begin
				break;
			end;
		end
		else
		begin
			result[j] := result[j] + s[i];
		end;
	end;
end;

procedure get_ip_data(out address: ip_address; out netmask: ip_address; out gateway: ip_address);
var
	list: array[0..3] of string;
	tf: textfile;
	line: string;
begin
	if fileexists('/etc/network/interfaces') then
	begin
		assignfile(tf, '/etc/network/interfaces');
		reset(tf);
		while not eof(tf) do
		begin
			readln(tf, line);
			line := trim(line);
			list := get_ip(rightstr(line, length(line) - 8));
			case leftstr(line, 8) of
				'address ':
				begin
					address := list;
				end;
				'netmask ':
				begin
					netmask := list;
				end;
				'gateway ':
				begin
					gateway := list;
				end;
			end;
		end;
		closefile(tf);
	end;
end;

end.


English | Magyar
JS ki | CSS ki | Ékezetek ki | HiContrast
Lapozó:  (0 - 1424) 
<== | ==>
Ugrás a végére | Összes megjelenítése | Utolsó oldal
OpenOpera patches | Opera-SSL patches | Opera 12.15 source (Git repository) | Opera 12.15 source (Torrent) | Opera internal pages | Otter Browser Linux x64 - Qt5.15.2/QtWebKit5.602.1 (2024.04.27. 20:05)
OS for MC680x0 | OS for PPC | OS for Sparc64 | besztofbégéaefcé | CSÉNDZSLOG | WebToolz | DDG Shit Filter | Google Shit Filter | Progz | Fast CSS Box | Browser | OS | Agent | Statisztika | BBCode
Monospace font-family: Courier New | Browser default monospace
Email értesítő / Email notification ===> 
Keresés

Név: (max 255 byte)

Email: (max 255 byte) Nem kötelező!

Üzenet: (max 65536 kar.) 65536-0=65536




crap_vkn v4.34.0 by TCH
Thx to saxus for the escaped string decoder function (PHP), the realIP function (PHP) & the SQL handle layer (PHP), to thookerov for the int_divide function (PHP), to Jeff Anderson for the getSelText function (JS), to Alex King for the insertAtCursor function (JS), Flood3r for the new CSS styles, Pety for the spamprotection idea and some design and comfort ideas, MaxMind for the IP2Country database, famfamfam for the flags of countries and an unknown PHP programmer for the removeAccents function.



Kecskebaszók ide!