Thelete na sas hackepsw sta grhgora?

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Oct 17 16:31:21 EEST 2006


On 2006-10-17 15:59, Fotis Georgatos <gef at ceid.upatras.gr> wrote:
> 
> O/H Giorgos Keramidas έγραψε:
> >>Gia na se bothisw: Kyriws den hackevei systhmata alla toys admin toys
> >>;-)
> 
> Hint1: Me alla logia, ayto prepei na to dokimasete san root.
> (kapoioi akoma psaxnontai arages?).

An hsoun pelaths kai ekanes `bug report' me ayto to styl, tha to eixa
kleisei hdh ws `INVALID' sto bug tracking systhma.

>> Den hackepse tipota edw pera se:
>> 
>>     FreeBSD 7.0-CURRENT
>>     FreeBSD 5.3-RELEASE
>>     Linux Fedora Core 1
>>     Linux Fedora Core 3
>>     Solaris 8 12/02
>>     Solaris 10 01/06
>> 
>> An me to parapanw ennoeis oti `me hackepse kai me ebale sth diadikasia
>> na afierwsw kapoio xrono na mantepsw ti upoti8etai oti kanei', epiase.
>> 
>> Alla de nomizw na exei kamia allh parenergeia, pera apo to na akyrwnei
>> th dynatothta na kaneis SCP arxeia (opws ola ta scripts pou bazoun
>> enoxlhtika `echo' mhnymata sto `.bashrc').
> 
> Twra me mperdepses... to oti eisai sthn perioxh thn apanthshs, eimai 
> bebaios.

Egw den eimai bebaios akoma ti perimeneis na deis.  Ayto pou blepw egw
einai ena panemorfo `/etc/passwd' file, me akribws ta swsta dedomena.

To `hack' tha mas peis poio upoti8etai oti einai, h 8a prepei na se
hackepsoume ontws gia na doyme me ti environment trexei to less(1) sto
diko soy systhma? :P

> To oti *to dokimases ontws* kai *to eides ontws*, den eimai... me hackepses!

To `hack' eksartatai apo polla pragmata:

    a) Apo thn yparksh tou LESSOPEN sto environment tou root

    b) Apo to gegonos oti to /bin/sh se Linux einai to bash

    c) Apo to gegonos oti kaneis 'echo' pragmata pou den prepei apo to
       .bashrc file

Nai, ontws to `lesspipe.sh' malakizetai opws tha deis parakatw:

    fedora# env | grep LESS
    LESSOPEN=|/usr/bin/lesspipe.sh %s
    fedora# tail -1 .bashrc
    echo Hello world
    fedora# less /etc/passwd | col -b | head -3
    Hello world
    fedora#

*AKRIBWS* se ayto anaferomoun sta prohgoumena posts.  H lysh einai poly
aplh.  Den bazoume sto environment tou root blakeies:

    fedora# unset LESSOPEN
    fedora# less /etc/passwd | col -b | head -3
    root:x:0:0:root:/root:/bin/bash
    bin:x:1:1:bin:/bin:/sbin/nologin
    daemon:x:2:2:daemon:/sbin:/sbin/nologin
    fedora#

Autou tou eidous to `bug' omws yparxei mono se Linux (pou exei to bash
ws /bin/sh by default), mono an eisai root, kai mono an exeis dialysei
to .bashrc sou (mono, dhladh, an to LESSOPEN einai set sto environment).

Apla twra ksereis giati kata kairous stelnw email me brisidia otan blepw
kaloproairetes alla xazes allages se system-wide startup scripts, opws
to parakatw (tyxaio paradeigma apo fetos):

% Date: Sun, 19 Feb 2006 04:54:00 +0200
% From: Giorgos Keramidas <keramida at ceid.upatras.gr>
% Subject: Xalasate to SCP sto diogeni
% To: CEID Unix group
% 
% Shmera allakse to /etc/bash.bashrc.local kai pleon periexei to ekshs:
% 
%     diogenis:/etc$ cat -n bash.bashrc.local
%     [...]
%         35
%         36  date | sed -e :a -e 's/^.\{1,78\}$/ &/;ta'
%         37
% 
% Einai xazo auto.  To mhnyma 8a tupw8ei akoma ki otan yparxei to arxeio
% ``~/.hushlogin''
% 
% Auto shmainei pws pleon to SCP, pou sthrizetai sto na MHN TUPWNONTAI
% ARXHSTES BLAKEIES sto socket pou anoigei, den paizei swsta.  Sto log pou
% akolouthei fainetai kathe leptomereia, gia opoion endiaferetai na dei
% giati auto einai lathos.
%
% [ snip polles grammes me mallon oxi kai toso kalo styl ]

Den einai tyxaio pou oi sobaroi admins parakolouthoun kathe allagh sta
shell startup scripts tou `root' kai einai *POLY* kakoi otan blepoun
allages pou moiazoun `epikindynes'.





More information about the Linux-greek-users mailing list