You are not logged in.

wcf.regNote.message

  • "Cyberscitymaste" started this thread

Posts: 10

  • Send private message

1

Monday, October 31st 2005, 9:09pm

Shell comando ausführen und auch wieder Stoppen

Hallo liebe Leute ich suche eine möglich keit via PHP ein bash befehl ./sc_trans_linux auszuführen
aber wiederum muss ich diesen Prozess auch wieder beenden können
kann mir da jemand einen Tip geben

badmoon2049

Intermediate

Posts: 188

Location: Leipzig

Occupation: Azubi

  • Send private message

2

Monday, October 31st 2005, 9:29pm

schau mal hier vieleicht hilft dir der thread weiter PHP script ruft c++ code auf
prozesse beenden mach man doch über kill und dann die pid und wech isser

  • "Cyberscitymaste" started this thread

Posts: 10

  • Send private message

3

Tuesday, November 1st 2005, 12:52am

ist leider Nicht verwendbar

ich habe da was gefunden doch die Passwort abfrage verstehe ich da nicht so ganz
und brauchen tue ich sie eh nich
habe 2 sh files erstellt die ich mit putti auch starten kann und laufen
nun meine frage kann man das phpscript so um modeln das root die sachen ausführt wenn die butten gedrückt werden.
wäre echt cool wenn das jemand hin bekommt

P.S. ach wenn ich das .sh file direkt aufrufe dann will er es downloaden

PHP Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?
    function check($pass)
        {
        $return=false;
        $hash=file('pass');
        $hash=$hash[0];

        if ($hash == md5($pass))
            {
            $return=true;
            }

        return $return;
        }

    if ($_GET['SCHROTT'] == "")
        {
        echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>shoutcast micropanel</title>
</head>
<style>
body{background-color:#ffffff; font-size:9pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>
<body>');
        $loggedin=false;

        if ($_POST['pass'] == "" and $_COOKIE['pass'] == "")
            {
            //login
            echo ("<table><tr><td>Password:</td><td><form action=$PHP_SELF method=post><input type=password name=pass></td><td><input type=submit value='O.K.'></td></table></form>");
            }
        elseif ($_POST['pass'] != "" and $_COOKIE['pass'] == "")
            {
            if (check($_POST['pass']))
                {
                $loggedin=true;
                setcookie('pass'$_POST['pass']);
                }
            else
                {
                die ('Wrong Password, try <a href="javascript:history.back()">again</a>');
                }
            }
        elseif ($_COOKIE['pass'] != "")
            {
            if (check($_COOKIE['pass']))
                {
                $loggedin=true;
                }
            else
                {
                setcookie('pass'"");
                echo('User management error, please re-login. Your Browser *MUST* accept cookies.');
                }
            }

        if (!$loggedin)
            {
            die ('');
            }
        else
            {
            echo ('<center><div style="border:solid 1px #000000; width:300; padding:0; margin:5;">
<div style="border-bottom:solid 1px #000000; width:300px; min-width:300px; font-decoration:underlined;  background-color:#bbbbbb; font-weight:bold;">
Show-itJukebox   Shoutcast Port6666:
</div>

<div style="margin:5px; padding-left:5; padding-right:5; border:solid 1px #000000; width:280;"> 
<center><a target=execute href=' $PHP_SELF '?SCHROTT=conf&action=1> Jukebox Einschalten</a>      <a target=execute href=' $PHP_SELF '?SCHROTT=conf&action=2>Jukebox Auschalten</a></center>
</div>

</div>


<div style="border:solid 1px #000000; width:300; padding:0; margin:5;">
<div style="border-bottom:solid 1px #000000; width:100%; font-decoration:underlined;  background-color:#bbbbbb; font-weight:bold;">
Executing Output:
</div>
<iframe name=execute frameborder=0 width=280; height=60; style="margin:5px; border:solid 1px #000000;" src=about:blank ></iframe>
</div>
</center>
</body>
</html>
');
            }
        }
    else
        {
        switch ($_GET['SCHROTT'])
            {
            case 'status':
                { echo ('
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>shoutcast micropanel</title>
<meta http-equiv="refresh" content="3; URL='
                           $PHP_SELF
                           '?SCHROTT=status">

</head>
<style>
body{background-color:#ffffff; font-size:9pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>
<body>
<center>');


                echo ('</center></body></html>');
                    }

                break;

            case 'chpass':
                {
                echo ('
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>shoutcast micropanel</title>
</head>

<html>
<head>
    <title>shoutcast micropanel</title>
</head>
<style>
body{background-color:#ffffff; font-size:7pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>
<body>
');

                if (check($_COOKIE['pass']))
                    {
                    $exe="/var/www/web3/html/media/sc_trans_040/radiostart.sh";
                    echo ("Starting...<br>Executing '$exe'");
                    system ($exe);
                    }
                else
                    {
                    echo ('Denied.');
                    }

                echo ('</body></html>');
                break;
                    }

            case 'stop':
                {
                echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>shoutcast micropanel</title>
</head>
<style>
body{background-color:#ffffff; font-size:7pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>
<body>');

                if (check($_COOKIE['pass']))
                    {
                    $exe="/var/www/web3/html/media/sc_trans_040/radiostop.sh";
                    echo ("Stopping...<br>Executing '$exe'");
                    system ($exe);
                    }
                else
                    {
                    die ('Denied.');
                    }

                echo ('</body></html>');
                break;
                    }

            case 'logout':
                {
                echo ('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>shoutcast micropanel</title>
<meta http-equiv="refresh" content="2; URL=index.php">
</head>
<style>
body{background-color:#ffffff; font-size:9pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>

<html>
<style>
body{background-color:#ffffff; font-size:7pt; font-family:sans-serif;}
input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
table{font-size:9pt; font-family:sans-serif;}
a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
</style>
<body>
        <html>
        <head>
        <title>shoutcast micropanel</title>
        </head>
        <style>
        body{background-color:#ffffff; font-size:7pt; font-family:sans-serif;}
        input{border:solid 1px #000000; font-size:9pt; font-family:sans-serif;}
        table{font-size:9pt; font-family:sans-serif;}
        a{font-size:9pt; font-family:sans-serif; color:#444444; font-weight:bold;}
        </style>
        <body>');
        $action=$_GET['action'];
        if ($action=="1") {
            system("/var/www/web3/html/media/sc_trans_040/radiostop.sh");
            echo "Jukebox gestoppt";
        }
        elseif ($action=="2") {
            system("/var/www/web3/html/media/sc_trans_040/radiostart.sh");
            echo "Jukebox aktiviert";
        }
    echo ('</body></html>');
    break;
    }
    
    }
}
?>



EDIT : Badmoon2049 hab mal deine Code in PHP tags gesetzt damit es besser zu lesen ist bitte beim nächsten mal beachten :)

heino1989

Beginner

Posts: 12

  • Send private message

4

Tuesday, November 1st 2005, 2:53pm

Wie wärs mit den [PHP]-Tags ?

badmoon2049

Intermediate

Posts: 188

Location: Leipzig

Occupation: Azubi

  • Send private message

5

Tuesday, November 1st 2005, 4:27pm

öhm also Linux kommt bei mir noch dran im unterrichtsstoff aber vll klappt es ja verschiebe mal die datei in bin vezeichniss oder warte gib ihm doch ausführungsrechte über FTP vll klappt das

  • "Cyberscitymaste" started this thread

Posts: 10

  • Send private message

6

Saturday, November 5th 2005, 11:41am

warum macht der das Nicht

also ich habs nu hin bekommen doch er führt das nicht aus sprich ich habe es nun mal mit 2 PHP files probiert da gehts

Source code

1
2
 echo shell_exec('/srv/www/htdocs/web11/html/stream/start.sh');
 
das geht in meinem start script manuell

doch warum macht der das hier nicht

Source code

1
 if (check($_COOKIE['pass'])) { $exe="/srv/www/htdocs/web11/html/stream/stop.sh"; echo ("Stopping...<br>Executing '$exe'"); system ($exe); } else { die ('Denied.'); } echo ('</body></html>'); break; }

siehe obiges script da ist es komplett

wcf.user.socialbookmarks.titel