| Revision | be904f7713d6d00b348d3c7e14865864649d45d6 (tree) |
|---|---|
| Time | 2010-03-30 14:42:54 |
| Author | “nanbuwks” <“nanbuwks-sourceforge@nanb...> |
| Commiter | “nanbuwks” |
new rule
| @@ -1,3 +1,4 @@ | ||
| 1 | +squarantine 0.3 2010/03/30 new rule set | |
| 1 | 2 | squarantine 0.22 2010/03/30 fix to usbremove bug |
| 2 | 3 | squarantine 0.21 2010/03/30 INSTALL document fix and contain /etc/sodoers file |
| 3 | 4 | squarantine 0.2 2010/03/27 configration to /etc/squarantine/squarantine.conf |
| @@ -72,12 +72,25 @@ sub makeattfile { | ||
| 72 | 72 | $dirname = $nickname; |
| 73 | 73 | $dirname =~ s/[<>:\*\?\|\"\/\\]//g; |
| 74 | 74 | system("mkdir -p /var/squarantine/usbstorages/$dirname"); |
| 75 | - | |
| 75 | + if ( 4 == ( 4 & $flags )) { $pagecode = 4; } else { $pagecode = $flags; } | |
| 76 | + | |
| 76 | 77 | #### MAKE ATTENTION FILE FROM TEMP FILE ################# |
| 77 | 78 | # system("cp /var/squarantine/templates/未登録.html /var/squarantine/usbstorages/$dirname"); |
| 78 | 79 | #$templatefile = "/var/squarantine/www/templates/未登録.html"; |
| 79 | 80 | #$attentionfile = "/var/squarantine/usbstorages/$dirname/未登録.html"; |
| 80 | - while (defined($templatefile = </var/squarantine/www/templates/$flags\.*> )) { | |
| 81 | + $action=""; | |
| 82 | + if ( 1 == ( 1 & $flags )) { $action = $action."「使用禁止」" } | |
| 83 | + if ( 2 == ( 2 & $flags )) { $action = $action."「信頼済」" } | |
| 84 | + if ( 4 == ( 4 & $flags )) { $action = $action."「操作前確認」" } | |
| 85 | + if ( 8 == ( 8 & $flags )) { $action = $action."「削除ファイルをバックアップ」" } | |
| 86 | + if ( 16 == ( 16 & $flags )) { $action = $action."「実行ファイル削除」" } | |
| 87 | + if ( 32 == ( 32 & $flags )) { $action = $action."「検疫済ファイルを外部にコピー」" } | |
| 88 | + if ( 64 == ( 64 & $flags )) { $action = $action."「フォーマット」" } | |
| 89 | + if ( 128 == ( 128 & $flags )) { $action = $action."「使用停止」" } | |
| 90 | + if ( 256 == ( 256 & $flags )) { $action = $action."「検疫後共有公開」" } | |
| 91 | + if ( 512 == ( 512 & $flags )) { $action = $action."「持出可」" } | |
| 92 | + | |
| 93 | + while (defined($templatefile = </var/squarantine/www/templates/$pagecode\.*> )) { | |
| 81 | 94 | $filename = $templatefile; |
| 82 | 95 | $filename =~ s#.*/##; # get file name |
| 83 | 96 | $attentionfile = "/var/squarantine/usbstorages/$dirname/$filename"; |
| @@ -86,8 +99,10 @@ sub makeattfile { | ||
| 86 | 99 | open(FILE , "$templatefile" ) or die "tempate file open error"; |
| 87 | 100 | while (<FILE>) { |
| 88 | 101 | s/\#\#ID\#\#/$id/g ; |
| 102 | + s/\#\#ACTION\#\#/$action/g ; | |
| 89 | 103 | s/\#\#DEVNAME\#\#/$ENV{'DEVNAME'}/g ; |
| 90 | - s/\#\#WEBROOT\#\#/$conf->{WEBROOT}/g ; | |
| 104 | + s/\#\#FLAGS\#\#/$ENV{'FLAGS'}/g ; | |
| 105 | + s/\#\#WEBROOT\#\#/$conf->{'WEBROOT'}/g ; | |
| 91 | 106 | print FILE2 $_; |
| 92 | 107 | } |
| 93 | 108 | close(FILE); |
| @@ -129,58 +144,77 @@ if ( 0 == $num_rows ){ | ||
| 129 | 144 | |
| 130 | 145 | } else { |
| 131 | 146 | ############ GET INFO ########### |
| 132 | -my $sth = $dbh->prepare("select id,id_serial,nickname,memo,flags from media where id_serial=\'".$ENV{'ID_SERIAL'}."\'"); | |
| 147 | +my $sth = $dbh->prepare("select id,id_serial,nickname,memo,flags,distpath,distaccount from media where id_serial=\'".$ENV{'ID_SERIAL'}."\'"); | |
| 133 | 148 | $sth->execute; |
| 134 | 149 | $num_rows = $sth->rows; |
| 135 | 150 | for ($i=0; $i<$num_rows; $i++) { |
| 136 | 151 | @a = $sth->fetchrow_array; |
| 137 | - $id = $a[0]; | |
| 138 | - $id_serial = $a[1]; | |
| 139 | - $memo = $a[3]; | |
| 140 | - $flags = $a[4]; | |
| 141 | - $nickname = $a[2]; | |
| 152 | + $id = $a[0]; | |
| 153 | + $id_serial = $a[1]; | |
| 154 | + $memo = $a[3]; | |
| 155 | + $flags = $a[4]; | |
| 156 | + $distpath = $a[5]; | |
| 157 | + $distaccount = $a[6]; | |
| 158 | + $nickname = $a[2]; | |
| 159 | + $ENV{'FLAGS'} = $flags; | |
| 142 | 160 | } |
| 143 | - if ( 1 == $flags ) | |
| 161 | + if ( 1 ==( 1 & $flags ) ) | |
| 144 | 162 | { |
| 145 | 163 | ################# 1: NOT PERMIT ################## |
| 146 | 164 | makeattfile($nickname,1); |
| 147 | - } elsif ( 2 == $flags ) { | |
| 148 | - ################# 2: STOP ################## | |
| 165 | + } elsif ( 2 == ( 2 & $flags )) { | |
| 166 | + ################# 2: FREE TO ADMINSITRATOR ################## | |
| 149 | 167 | makeattfile($nickname,2); |
| 150 | - } elsif ( 4 == $flags ) { | |
| 151 | - ################# 4: RESERVED ################## | |
| 152 | - makeattfile($nickname,4); | |
| 153 | - } elsif ( 8 == $flags ) { | |
| 154 | - ################# 8: AUTO FORMAT ################## | |
| 155 | - makeattfile($nickname,8); | |
| 156 | - system("mkfs.vfat $ENV{'DEVNAME'} > /var/log/squarantine.log"); | |
| 157 | - system("echo mkfs.vfat $ENV{'DEVNAME'} >> /var/log/squarantine.log"); | |
| 158 | - system("mkdir -p /mnt$ENV{'DEVNAME'}"); | |
| 159 | - #system("mount -o umask=000 $ENV{'DEVNAME'} /mnt$ENV{'DEVNAME'}"); | |
| 160 | - #system("ln -s /mnt$ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 161 | - system("mount -o umask=000 $ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 162 | - | |
| 163 | - } elsif ( 16 == $flags ) { | |
| 164 | - ################# 16: MANUAL FORMAT ################## | |
| 165 | - makeattfile($nickname,16); | |
| 166 | - } elsif ( 32 == $flags ) { | |
| 167 | - ################# 32: AUTO DELETE ################## | |
| 168 | - makeattfile($nickname,32); | |
| 169 | - system("mkdir -p /mnt$ENV{'DEVNAME'}"); | |
| 170 | - system("mount $ENV{'DEVNAME'} /mnt$ENV{'DEVNAME'}"); | |
| 171 | - autodelete("/mnt".$ENV{'DEVNAME'}); | |
| 172 | - system("umount $ENV{'DEVNAME'}"); | |
| 173 | - system("mount -o umask=000 $ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 174 | - | |
| 175 | - } elsif ( 64 == $flags ) { | |
| 176 | - ################# 64: MANUAL DELETE ################## | |
| 177 | - makeattfile($nickname,64); | |
| 178 | - } elsif ( 128 == $flags ) { | |
| 179 | - ################# 128: FREE TO ADMINISTRATOR ################## | |
| 180 | - makeattfile($nickname,128); | |
| 168 | + } elsif ( 4 == ( 4 & $flags )) { | |
| 169 | + ################# 16+4: MANUAL DELETE ################## | |
| 170 | + ################# 32+4: MANUAL EXPORT ################## | |
| 171 | + ################# 64+4: MANUAL FORMAT ################## | |
| 172 | + ################# etc ################## | |
| 173 | + makeattfile($nickname,$flags); | |
| 174 | + } else { | |
| 175 | + if ( 16 == ( 16 & $flags )) { | |
| 176 | + ################# 16: AUTO DELETE ################## | |
| 177 | + makeattfile($nickname,16); | |
| 178 | + system("mkdir -p /mnt$ENV{'DEVNAME'}"); | |
| 179 | + system("mount $ENV{'DEVNAME'} /mnt$ENV{'DEVNAME'}"); | |
| 180 | + autodelete("/mnt".$ENV{'DEVNAME'}); | |
| 181 | + system("umount $ENV{'DEVNAME'}"); | |
| 182 | + } | |
| 183 | + if ( 32 == ( 32 & $flags )) { | |
| 184 | + ################# 32: DATA EXPORT ################## | |
| 185 | + makeattfile($nickname,32); | |
| 186 | + system("mkdir -p /mnt$ENV{'DEVNAME'}"); | |
| 187 | + system("mount $ENV{'DEVNAME'} /mnt$ENV{'DEVNAME'}"); | |
| 188 | + system("smbmount $distpath /mnt/$id -o username=$distaccount"); | |
| 189 | + system("cp -a /mnt$ENV{'DEVNAME'}/ /mnt/$id"); | |
| 190 | + system("umount $ENV{'DEVNAME'}"); | |
| 191 | + # system("umount /mnt/$id"); | |
| 192 | + } | |
| 193 | + if ( 64 == ( 64 & $flags )) { | |
| 194 | + ################# 64: AUTO FORMAT ################## | |
| 195 | + makeattfile($nickname,64); | |
| 196 | + system("mkfs.vfat $ENV{'DEVNAME'} > /var/log/squarantine.log"); | |
| 197 | + system("echo mkfs.vfat $ENV{'DEVNAME'} >> /var/log/squarantine.log"); | |
| 198 | + #system("mkdir -p /mnt$ENV{'DEVNAME'}"); | |
| 199 | + #system("mount -o umask=000 $ENV{'DEVNAME'} /mnt$ENV{'DEVNAME'}"); | |
| 200 | + #system("ln -s /mnt$ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 201 | + } | |
| 202 | + if ( 128 == ( 128 & $flags )) { | |
| 203 | + ################# 128: STOP ################## | |
| 204 | + makeattfile($nickname,128); | |
| 205 | + } else { | |
| 206 | + if ( 256 == ( 256 & $flags )) { | |
| 207 | + ################# 256: MOUNT ################## | |
| 208 | + if ( 512 == ( 512 & $flags )) { | |
| 209 | + ################# 512: WRITEABLE ################## | |
| 210 | + system("mount -o umask=000 $ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 211 | + } else { | |
| 212 | + ################# : READONLY ################## | |
| 213 | + system("mount -r -o umask=000 $ENV{'DEVNAME'} /var/squarantine/usbstorages/$nickname"); | |
| 214 | + } | |
| 215 | + } | |
| 216 | + } | |
| 181 | 217 | } |
| 182 | - | |
| 183 | - | |
| 184 | 218 | } |
| 185 | 219 | $sth->finish; |
| 186 | 220 | $dbh->disconnect; |
| @@ -8,15 +8,29 @@ | ||
| 8 | 8 | <?php |
| 9 | 9 | require_once('spyc.php'); |
| 10 | 10 | $conf = Spyc::YAMLLoad('/etc/squarantine/squarantine.conf'); |
| 11 | - | |
| 12 | 11 | $SAMBAPATH = "//192.168.0.51/usb/"; |
| 13 | 12 | if (isset( $_POST["id" ] )) { $_var[ "id"]=$_POST["id"] ; } |
| 14 | 13 | if (isset( $_POST["nickname"] )) { $_var["nickname"]=$_POST["nickname"]; } |
| 15 | -if (isset( $_POST["flags" ] )) { $_var[ "flags"]=$_POST["flags"]; } | |
| 16 | 14 | if (isset( $_POST["distpath"] )) { $_var["distpath"]=$_POST["distpath"]; } |
| 15 | +if (isset( $_POST["distaccount"] )) { $_var["distaccount"]=$_POST["distaccount"]; } | |
| 17 | 16 | if (isset( $_POST["memo" ] )) { $_var[ "memo"]=$_POST["memo"]; } |
| 18 | 17 | if (isset( $_POST["mode" ] )) { $_var[ "mode"]=$_POST["mode"]; } else { $_var["mode"]=0; } |
| 19 | 18 | if (isset( $_POST["devname" ] )) { $_var[ "devname"]=$_POST["devname"]; } |
| 19 | +if (isset( $_POST["flags1" ] )) { $_var["flags1" ]=$_POST["flags1" ]; } else { $_var["flags1" ]=0; } | |
| 20 | +if (isset( $_POST["flags2" ] )) { $_var["flags2" ]=$_POST["flags2" ]; } else { $_var["flags2" ]=0; } | |
| 21 | +if (isset( $_POST["flags4" ] )) { $_var["flags4" ]=$_POST["flags4" ]; } else { $_var["flags4" ]=0; } | |
| 22 | +if (isset( $_POST["flags8" ] )) { $_var["flags8" ]=$_POST["flags8" ]; } else { $_var["flags8" ]=0; } | |
| 23 | +if (isset( $_POST["flags16" ] )) { $_var["flags16" ]=$_POST["flags16" ]; } else { $_var["flags16" ]=0; } | |
| 24 | +if (isset( $_POST["flags32" ] )) { $_var["flags32" ]=$_POST["flags32" ]; } else { $_var["flags32" ]=0; } | |
| 25 | +if (isset( $_POST["flags64" ] )) { $_var["flags64" ]=$_POST["flags64" ]; } else { $_var["flags64" ]=0; } | |
| 26 | +if (isset( $_POST["flags128" ] )) { $_var["flags128" ]=$_POST["flags128" ]; } else { $_var["flags128" ]=0; } | |
| 27 | +if (isset( $_POST["flags256" ] )) { $_var["flags256" ]=$_POST["flags256" ]; } else { $_var["flags256" ]=0; } | |
| 28 | +if (isset( $_POST["flags512" ] )) { $_var["flags512" ]=$_POST["flags512" ]; } else { $_var["flags512" ]=0; } | |
| 29 | +if (isset( $_POST["flags1024"] )) { $_var["flags1024"]=$_POST["flags1024"]; } else { $_var["flags1024" ]=0; } | |
| 30 | + $_var["flags"]= $_var["flags1" ]+ $_var["flags2" ]+ $_var["flags4" ]+ $_var["flags8" ]+ $_var["flags16" ]+ $_var["flags32" ]+ $_var["flags64" ]+ $_var["flags128" ]+ $_var["flags256" ]+ $_var["flags512" ]+ $_var["flags1024" ]; | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 20 | 34 | if (isset( $_POST["adminid" ] ) && isset( $_POST["adminpass"] ) && 0 == strcmp( "admin",$_POST["adminid"] ) && 0 == strcmp( $conf["WEB_ADMINPASS"],$_POST["adminpass"] )) { |
| 21 | 35 | $_var["adminmode"] = 1; |
| 22 | 36 | } else { |
| @@ -38,31 +52,13 @@ $db = 'squarantine'; | ||
| 38 | 52 | |
| 39 | 53 | ?> |
| 40 | 54 | <?php |
| 41 | -<table style="border:0" width="100%"> | |
| 42 | -<tbody><tr> | |
| 43 | -<td style="border:0"><img src="image/addr.png" alt="address"></td> | |
| 44 | -<td style="border:0"><img src="image/logo.png" alt="Logo" align="right"></td> | |
| 45 | -<td style="border:1"><form action=regist.php method=POST> | |
| 46 | - <table border=1><tr><td><input type=text name=adminid>:ID</td></tr><tr><td><input type=password name=adminpass>:PASS</td></tr></table> | |
| 47 | -<input type="hidden" name="mode" value="change"> | |
| 48 | -<input type="submit" value="login"> | |
| 49 | -<?php | |
| 50 | -if ( 1 == isset( $_var["id"] )) { | |
| 51 | -?> | |
| 52 | -<input type="hidden" name="id" value="<?php echo $_var[ "id"]; ?>"> | |
| 53 | -<?php } ?> | |
| 54 | -</form> | |
| 55 | -</td> | |
| 56 | -</tr></tbody> | |
| 57 | -</table> | |
| 58 | -<?php | |
| 59 | 55 | |
| 60 | -if ( 0 == isset( $_var["id"] )){ | |
| 56 | +if ( 0 == isset( $_var["id"] )){ | |
| 61 | 57 | // ----------------------------------------------- list mode start----------------------- |
| 62 | - print("<h1>登録済みUSBデバイス一覧</h1>"); | |
| 58 | +// print("<h1>登録済みUSBデバイス一覧</h1>"); | |
| 63 | 59 | |
| 64 | 60 | |
| 65 | - $sql = "select id,id_serial,nickname,memo,flags from media"; | |
| 61 | + $sql = "select id,id_serial,nickname,memo,flags,distpath,distaccount from media"; | |
| 66 | 62 | $results = mysql_db_query($db,$sql); |
| 67 | 63 | if (!$results) |
| 68 | 64 | { |
| @@ -72,9 +68,243 @@ if ( 0 == isset( $_var["id"] )){ | ||
| 72 | 68 | $num = mysql_num_fields($results); |
| 73 | 69 | ?> |
| 74 | 70 | |
| 75 | -<table border=1><tr><th></th><th>ID</th><th>名前</th><th>説明</th><th>動作</th><th></th></tr> | |
| 71 | +<table> | |
| 72 | +<tbody> | |
| 73 | +<tr> | |
| 74 | +<td colspan="4" rowspan="11" style="vertical-align: top;"><br> | |
| 75 | +<table style="border: 0pt none ;" width="100%"> | |
| 76 | +<tbody> | |
| 77 | +<tr> | |
| 78 | +<td style="border: 0pt none ;"><img src="image/addr.png" | |
| 79 | +alt="address"></td> | |
| 80 | +<td style="border: 0pt none ;"><img src="image/logo.png" | |
| 81 | +alt="Logo" align="right"></td> | |
| 82 | +<td style=""> | |
| 83 | +<form action="regist.php" method="post"> | |
| 84 | +<table border="1"> | |
| 85 | +<tbody> | |
| 86 | +<tr> | |
| 87 | +<td><input name="adminid" type="text">:ID</td> | |
| 88 | +</tr> | |
| 89 | +<tr> | |
| 90 | +<td><input name="adminpass" type="password">:PASS</td> | |
| 91 | +</tr> | |
| 92 | +</tbody> | |
| 93 | +</table> | |
| 94 | +<input name="mode" value="change" type="hidden"> | |
| 95 | +<input value="login" type="submit"> | |
| 96 | +<?php | |
| 97 | +if ( 1 == isset( $_var["id"] )) { | |
| 98 | +?> | |
| 99 | +<input type="hidden" name="id" value="<?php echo $_var[ "id"]; ?>"> | |
| 100 | +<?php } ?> | |
| 101 | +</form> | |
| 102 | +</td> | |
| 103 | +</tr> | |
| 104 | +</tbody> | |
| 105 | +</table> | |
| 76 | 106 | |
| 77 | 107 | |
| 108 | +<h1>登録済みUSBデバイス一覧</h1> | |
| 109 | +</td> | |
| 110 | +<th style="vertical-align: top;">┏<br> | |
| 111 | +</th> | |
| 112 | +<td colspan="11" rowspan="1" style="vertical-align: top;">*未登録<br> | |
| 113 | +</td> | |
| 114 | +</tr> | |
| 115 | +<tr> | |
| 116 | +<th style="vertical-align: top;">|<br> | |
| 117 | +</th> | |
| 118 | +<th style="vertical-align: top;">┏ | |
| 119 | +</th> | |
| 120 | +<td colspan="10" rowspan="1" style="vertical-align: top;">*使用禁止<br> | |
| 121 | +</td> | |
| 122 | +</tr> | |
| 123 | +<tr> | |
| 124 | +<th style="vertical-align: top;">|<br> | |
| 125 | +</th> | |
| 126 | +<th style="vertical-align: top;">|<br> | |
| 127 | +</th> | |
| 128 | +<th style="vertical-align: top;">┏ | |
| 129 | +</th> | |
| 130 | +<td colspan="9" rowspan="1" style="vertical-align: top;">*信頼済(管理者 | |
| 131 | +のみ利用)<br> | |
| 132 | +</td> | |
| 133 | +</tr> | |
| 134 | +<tr> | |
| 135 | +<th style="vertical-align: top;">|<br> | |
| 136 | +</th> | |
| 137 | +<th style="vertical-align: top;">|<br> | |
| 138 | +</th> | |
| 139 | +<th style="vertical-align: top;">|<br> | |
| 140 | +</th> | |
| 141 | +<th style="vertical-align: top;">┏ | |
| 142 | +</th> | |
| 143 | +<td colspan="8" rowspan="1" style="vertical-align: top;">(操作前確認<br> | |
| 144 | +</td> | |
| 145 | +</tr> | |
| 146 | +<tr> | |
| 147 | +<th style="vertical-align: top;">|<br> | |
| 148 | +</th> | |
| 149 | +<th style="vertical-align: top;">|<br> | |
| 150 | +</th> | |
| 151 | +<th style="vertical-align: top;">|<br> | |
| 152 | +</th> | |
| 153 | +<th style="vertical-align: top;">|<br> | |
| 154 | +</th> | |
| 155 | +<th style="vertical-align: top;">┏ | |
| 156 | +</th> | |
| 157 | +<td colspan="7" rowspan="1" style="vertical-align: top;">(削除ファイルを | |
| 158 | +バックアップ<br> | |
| 159 | +</td> | |
| 160 | +</tr> | |
| 161 | +<tr> | |
| 162 | +<th style="vertical-align: top;">|<br> | |
| 163 | +</th> | |
| 164 | +<th style="vertical-align: top;">|<br> | |
| 165 | +</th> | |
| 166 | +<th style="vertical-align: top;">|<br> | |
| 167 | +</th> | |
| 168 | +<th style="vertical-align: top;">|<br> | |
| 169 | +</th> | |
| 170 | +<th style="vertical-align: top;">|<br> | |
| 171 | +</th> | |
| 172 | +<th style="vertical-align: top;">┏ | |
| 173 | +</th> | |
| 174 | +<td colspan="6" rowspan="1" style="vertical-align: top;">実行ファイル削除<br> | |
| 175 | +</td> | |
| 176 | +</tr> | |
| 177 | +<tr> | |
| 178 | +<th style="vertical-align: top;">|<br> | |
| 179 | +</th> | |
| 180 | +<th style="vertical-align: top;">|<br> | |
| 181 | +</th> | |
| 182 | +<th style="vertical-align: top;">|<br> | |
| 183 | +</th> | |
| 184 | +<th style="vertical-align: top;">|<br> | |
| 185 | +</th> | |
| 186 | +<th style="vertical-align: top;">|<br> | |
| 187 | +</th> | |
| 188 | +<th style="vertical-align: top;">|<br> | |
| 189 | +</th> | |
| 190 | +<th style="vertical-align: top;">┏ | |
| 191 | +</th> | |
| 192 | +<td colspan="5" rowspan="1" style="vertical-align: top;">検疫済ファイルを外 | |
| 193 | +部にコピー | |
| 194 | +</td> | |
| 195 | +</tr> | |
| 196 | +<tr> | |
| 197 | +<th style="vertical-align: top;">|<br> | |
| 198 | +</th> | |
| 199 | +<th style="vertical-align: top;">|<br> | |
| 200 | +</th> | |
| 201 | +<th style="vertical-align: top;">|<br> | |
| 202 | +</th> | |
| 203 | +<th style="vertical-align: top;">|<br> | |
| 204 | +</th> | |
| 205 | +<th style="vertical-align: top;">|<br> | |
| 206 | +</th> | |
| 207 | +<th style="vertical-align: top;">|<br> | |
| 208 | +</th> | |
| 209 | +<th style="vertical-align: top;">|<br> | |
| 210 | +</th> | |
| 211 | +<th style="vertical-align: top;">┏ | |
| 212 | +</th> | |
| 213 | +<td colspan="4" rowspan="1" style="vertical-align: top;">フォーマット<br> | |
| 214 | +</td> | |
| 215 | +</tr> | |
| 216 | +<tr> | |
| 217 | +<th style="vertical-align: top;">|<br> | |
| 218 | +</th> | |
| 219 | +<th style="vertical-align: top;">|<br> | |
| 220 | +</th> | |
| 221 | +<th style="vertical-align: top;">|<br> | |
| 222 | +</th> | |
| 223 | +<th style="vertical-align: top;">|<br> | |
| 224 | +</th> | |
| 225 | +<th style="vertical-align: top;">|<br> | |
| 226 | +</th> | |
| 227 | +<th style="vertical-align: top;">|<br> | |
| 228 | +</th> | |
| 229 | +<th style="vertical-align: top;">|<br> | |
| 230 | +</th> | |
| 231 | +<th style="vertical-align: top;">|<br> | |
| 232 | +</th> | |
| 233 | +<th style="vertical-align: top;">┏ | |
| 234 | +</th> | |
| 235 | +<td colspan="3" rowspan="1" style="vertical-align: top;">*使用停止<br> | |
| 236 | +</td> | |
| 237 | +</tr> | |
| 238 | +<tr> | |
| 239 | +<th style="vertical-align: top;">|<br> | |
| 240 | +</th> | |
| 241 | +<th style="vertical-align: top;">|<br> | |
| 242 | +</th> | |
| 243 | +<th style="vertical-align: top;">|<br> | |
| 244 | +</th> | |
| 245 | +<th style="vertical-align: top;">|<br> | |
| 246 | +</th> | |
| 247 | +<th style="vertical-align: top;">|<br> | |
| 248 | +</th> | |
| 249 | +<th style="vertical-align: top;">|<br> | |
| 250 | +</th> | |
| 251 | +<th style="vertical-align: top;">|<br> | |
| 252 | +</th> | |
| 253 | +<th style="vertical-align: top;">|<br> | |
| 254 | +</th> | |
| 255 | +<th style="vertical-align: top;">|<br> | |
| 256 | +</th> | |
| 257 | +<th style="vertical-align: top;">┏ | |
| 258 | +</th> | |
| 259 | +<td colspan="2" rowspan="1" style="vertical-align: top;">検疫後共有公開<br> | |
| 260 | +</td> | |
| 261 | +</tr> | |
| 262 | +<tr> | |
| 263 | +<th style="vertical-align: top;">|<br> | |
| 264 | +</th> | |
| 265 | +<th style="vertical-align: top;">|<br> | |
| 266 | +</th> | |
| 267 | +<th style="vertical-align: top;">|<br> | |
| 268 | +</th> | |
| 269 | +<th style="vertical-align: top;">|<br> | |
| 270 | +</th> | |
| 271 | +<th style="vertical-align: top;">|<br> | |
| 272 | +</th> | |
| 273 | +<th style="vertical-align: top;">|<br> | |
| 274 | +</th> | |
| 275 | +<th style="vertical-align: top;">|<br> | |
| 276 | +</th> | |
| 277 | +<th style="vertical-align: top;">|<br> | |
| 278 | +</th> | |
| 279 | +<th style="vertical-align: top;">|<br> | |
| 280 | +</th> | |
| 281 | +<th style="vertical-align: top;">|<br> | |
| 282 | +</th> | |
| 283 | +<th style="vertical-align: top;">┏ | |
| 284 | +</th> | |
| 285 | +<td colspan="1" rowspan="1" style="vertical-align: top;">持出可(書込OK)</td> | |
| 286 | +</tr> | |
| 287 | + | |
| 288 | +<tr> | |
| 289 | +<th style="vertical-align: top;"></th> | |
| 290 | +<th style="vertical-align: top;">USB ID</th> | |
| 291 | +<th style="vertical-align: top;">名前</th> | |
| 292 | +<th style="vertical-align: top;">説明</th> | |
| 293 | +</th> | |
| 294 | +<th style="vertical-align: top;">|<br> </th> | |
| 295 | +<th style="vertical-align: top;">|<br> </th> | |
| 296 | +<th style="vertical-align: top;">|<br> </th> | |
| 297 | +<th style="vertical-align: top;">|<br> </th> | |
| 298 | +<th style="vertical-align: top;">|<br> </th> | |
| 299 | +<th style="vertical-align: top;">|<br> </th> | |
| 300 | +<th style="vertical-align: top;">|<br> </th> | |
| 301 | +<th style="vertical-align: top;">|<br> </th> | |
| 302 | +<th style="vertical-align: top;">|<br> </th> | |
| 303 | +<th style="vertical-align: top;">|<br> </th> | |
| 304 | +<th style="vertical-align: top;">|<br> </th> | |
| 305 | +<th>外部コピー先</th> | |
| 306 | +</tr> | |
| 307 | + | |
| 78 | 308 | <?php |
| 79 | 309 | while($row=mysql_fetch_array($results)) |
| 80 | 310 | { |
| @@ -84,15 +314,15 @@ if ( 0 == isset( $_var["id"] )){ | ||
| 84 | 314 | print("<td>".$row[$j]."</td>"); |
| 85 | 315 | } |
| 86 | 316 | if ( 0 == $row[4] ) { |
| 87 | - print ("<td>@</td>"); | |
| 317 | + print ("<td>●</td>"); | |
| 88 | 318 | } else { |
| 89 | - print ("<td></td>"); | |
| 319 | + print ("<td>│</td>"); | |
| 90 | 320 | } |
| 91 | 321 | for ( $i=1 ; $i<=512 ; $i = $i * 2 ) { |
| 92 | 322 | if ( 0 == ( $i & $row[4]) ){ |
| 93 | - $check=""; | |
| 323 | + $check="│"; | |
| 94 | 324 | } else { |
| 95 | - $check="@"; | |
| 325 | + $check="●"; | |
| 96 | 326 | } |
| 97 | 327 | print("<td>$check</td>"); |
| 98 | 328 | } |
| @@ -100,6 +330,9 @@ if ( 0 == isset( $_var["id"] )){ | ||
| 100 | 330 | // print ($row[4]); // flags |
| 101 | 331 | // print("</td>"); |
| 102 | 332 | print("<td>"); |
| 333 | + print ($row[5]); // distpath | |
| 334 | + print("</td>"); | |
| 335 | + print("<td>"); | |
| 103 | 336 | if (1 == $_var["adminmode"]){ |
| 104 | 337 | ?> |
| 105 | 338 | <form action="regist.php" method="post"> |
| @@ -132,7 +365,7 @@ exit(0); | ||
| 132 | 365 | } |
| 133 | 366 | // ----------------------------------------------- list mode end----------------------- |
| 134 | 367 | |
| 135 | -$sql = "select id_serial,nickname,flags,memo,distpath from media where id=\"".$_var["id"]."\""; | |
| 368 | +$sql = "select id_serial,nickname,flags,memo,distpath,distaccount from media where id=\"".$_var["id"]."\""; | |
| 136 | 369 | // echo $sql; |
| 137 | 370 | $results = mysql_db_query($db,$sql); |
| 138 | 371 | if (!$results) |
| @@ -143,20 +376,22 @@ if (!$results) | ||
| 143 | 376 | $num = mysql_num_fields($results); |
| 144 | 377 | while($row=mysql_fetch_array($results)) |
| 145 | 378 | { |
| 146 | - $org["id_serial"] =($row[0]); | |
| 147 | - $org["nickname" ] =($row[1]); | |
| 148 | - $org["flags" ] =($row[2]); | |
| 149 | - $org["memo" ] =($row[3]); | |
| 150 | - $org["distpath" ] =($row[4]); | |
| 379 | + $org["id_serial" ] =($row[0]); | |
| 380 | + $org["nickname" ] =($row[1]); | |
| 381 | + $org["flags" ] =($row[2]); | |
| 382 | + $org["memo" ] =($row[3]); | |
| 383 | + $org["distpath" ] =($row[4]); | |
| 384 | + $org["distaccount"] =($row[5]); | |
| 151 | 385 | } |
| 152 | 386 | mysql_free_result($results); |
| 153 | 387 | if ( 0 == strcmp("regist", $_var["mode"])){ |
| 154 | 388 | // ----------------------------------------------- new regist mode start----------------------- |
| 155 | 389 | $sql = "update media set |
| 156 | - nickname=\"".$_var["nickname"]."\", | |
| 157 | - flags =\"".$_var["flags"]."\", | |
| 158 | - memo =\"".$_var["memo"]."\", | |
| 159 | - distpath=\"".$_var["distpath"]."\" | |
| 390 | + nickname =\"".$_var["nickname"]."\", | |
| 391 | + flags =\"".$_var["flags"]."\", | |
| 392 | + memo =\"".$_var["memo"]."\", | |
| 393 | + distpath =\"".$_var["distpath"]."\", | |
| 394 | + distaccount=\"".$_var["distaccount"]."\" | |
| 160 | 395 | where id=\"".$_var["id"]."\""; |
| 161 | 396 | |
| 162 | 397 | $results = mysql_db_query($db,$sql); |
| @@ -190,40 +425,6 @@ print "$sql"; | ||
| 190 | 425 | <b>一旦抜いて、もう一度差し直してください</b> |
| 191 | 426 | <?php |
| 192 | 427 | //----------------------------new regist mode end ------------------- |
| 193 | -} else if ( 0 == strcmp("format", $_var["mode"])){ | |
| 194 | -//----------------------------format mode start -------------------- | |
| 195 | -print "<h1>format中...</h1>"; | |
| 196 | -print "<pre>"; | |
| 197 | -passthru("sudo mkfs.vfat ".$_var["devname"]); | |
| 198 | -passthru("sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 199 | -passthru("echo sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 200 | -#passthru("find /etc -name a*"); | |
| 201 | -print "</pre>"; | |
| 202 | -print "<h2>終了しました</h2>"; | |
| 203 | -print "<a href=\"file:".$conf["SAMBAPATH"]."\">こちらからアクセスしてください</a>"; | |
| 204 | - | |
| 205 | - | |
| 206 | -//----------------------------format mode end -------------------- | |
| 207 | -} else if ( 0 == strcmp("delete", $_var["mode"])){ | |
| 208 | -//----------------------------delete mode start -------------------- | |
| 209 | -print "<h1>消毒中...</h1>"; | |
| 210 | -print "<pre>"; | |
| 211 | -print $_var["devname"]."\n"; | |
| 212 | -passthru("sudo mount ".$_var["devname"]." /mnt".$_var["devname"]); | |
| 213 | -//passthru("sudo mount"); | |
| 214 | -//print "-------------\n"; | |
| 215 | -passthru("sudo usbsearchdelete /mnt".$_var["devname"]); | |
| 216 | -passthru("sudo umount ".$_var["devname"]); | |
| 217 | -passthru("sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 218 | -//passthru("sudo mount"); | |
| 219 | -//passthru("sudo echo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 220 | -//passthru("echo 123"); | |
| 221 | -//passthru("find /etc -name a*"); | |
| 222 | -print "</pre>"; | |
| 223 | -print "<h2>終了しました</h2>"; | |
| 224 | - | |
| 225 | - | |
| 226 | -//----------------------------delete mode end -------------------- | |
| 227 | 428 | } else if ( 0 == strcmp("change",$_var["mode"] )) { |
| 228 | 429 | //----------------------------device edit mdde start ----------------- |
| 229 | 430 | print("<h1>登録情報変更</h1>"); |
| @@ -237,105 +438,126 @@ print("<h1>登録情報変更</h1>"); | ||
| 237 | 438 | <br> |
| 238 | 439 | <input type="text" name=memo value="<?php echo $org["memo" ]; ?>">メモ(備忘録) |
| 239 | 440 | <br> |
| 240 | -<input type="text" name=flags value="<?php echo $org["flags" ]; ?>">動作指定 | |
| 441 | +動作指定 | |
| 241 | 442 | <br> |
| 443 | +<input type="checkbox" name=flags1 value="1" <?php if ( 0 != ( 1 &$org["flags"]) ) { print "checked"; } ?>>*使用禁止 | |
| 444 | +<br> | |
| 445 | +<input type="checkbox" name=flags2 value="2" <?php if ( 0 != ( 2 &$org["flags"]) ) { print "checked"; } ?>>*信頼済(管理者のみ利用) | |
| 446 | +<br> | |
| 447 | +<input type="checkbox" name=flags4 value="4" <?php if ( 0 != ( 4 &$org["flags"]) ) { print "checked"; } ?>>操作前確認 | |
| 448 | +<br> | |
| 449 | +<input type="checkbox" name=flags8 value="8" <?php if ( 0 != ( 8 &$org["flags"]) ) { print "checked"; } ?>>#削除ファイルをバックアップ | |
| 450 | +<br> | |
| 451 | +<input type="checkbox" name=flags16 value="16" <?php if ( 0 != ( 16 &$org["flags"]) ) { print "checked"; } ?>>実行ファイル削除 | |
| 452 | +<br> | |
| 453 | +<input type="checkbox" name=flags32 value="32" <?php if ( 0 != ( 32 &$org["flags"]) ) { print "checked"; } ?>>検疫済ファイルを外部にコピー | |
| 454 | +<br> | |
| 455 | +<input type="checkbox" name=flags64 value="64" <?php if ( 0 != ( 64 &$org["flags"]) ) { print "checked"; } ?>>フォーマット | |
| 456 | +<br> | |
| 457 | +<input type="checkbox" name=flags128 value="128" <?php if ( 0 != ( 128 &$org["flags"]) ) { print "checked"; } ?>>*使用停止 | |
| 458 | +<br> | |
| 459 | +<input type="checkbox" name=flags256 value="256" <?php if ( 0 != ( 256 &$org["flags"]) ) { print "checked"; } ?>>検疫後共有公開 | |
| 460 | +<br> | |
| 461 | +<input type="checkbox" name=flags512 value="512" <?php if ( 0 != ( 512 &$org["flags"]) ) { print "checked"; } ?>>持出可(書込OK) | |
| 242 | 462 | |
| 463 | +<br> | |
| 464 | +ルールは上から順番に適用されます。*印のついているものは、そこでストップします。#印のついているものは現在使用できません | |
| 465 | +<br> | |
| 466 | +<input type="text" name=distpath value="<?php echo $org["distpath"]; ?>">コピー先PATH //SERVERNAME/DIR/PATH のように入力してください | |
| 467 | +<br> | |
| 468 | +<input type="text" name=distaccount value="<?php echo $org["distaccount"]; ?>">コピー先PATHへのユーザ名、パスワード USERNAME%PASSWORDと入力してください。必要ない場合も%のみ入力してください | |
| 469 | +<br> | |
| 243 | 470 | <input type="submit"> |
| 244 | 471 | <input type="hidden" name="id" value="<?php echo $_var["id"]; ?>"> |
| 245 | 472 | <input type="hidden" name="mode" value="regist"> |
| 246 | 473 | </form> |
| 247 | 474 | <?php |
| 248 | 475 | //----------------------------device edit mode end------------- |
| 249 | -} else if ( 0 == $_var["mode"] ) { | |
| 476 | +} else if ( 0 == strcmp( "0", $_var["mode"] ) ) { | |
| 250 | 477 | //----------------------------new device found mode ----------------- |
| 251 | 478 | print("<h1>このUSBデバイス(".$org["nickname"].")は未登録です</h1>"); |
| 252 | 479 | |
| 253 | - | |
| 254 | 480 | ?> |
| 255 | 481 | |
| 256 | 482 | <b>以下のボタンから登録してください</b> |
| 257 | 483 | <form action="regist.php" method="POST"> |
| 258 | 484 | <input type="text" name=nickname value="<?php echo $org["nickname"]; ?>">ニックネームを登録してください |
| 485 | +<br> | |
| 259 | 486 | <input type="text" name=memo value="<?php echo $org["memo" ]; ?>">メモ(備忘録) |
| 260 | -<input type="text" name=flags value="<?php echo $org["flags" ]; ?>">動作指定 | |
| 261 | - | |
| 487 | +<br> | |
| 488 | +動作指定 | |
| 489 | +<br> | |
| 490 | +<input type="checkbox" name=flags1 value="1" <?php if ( 0 != ( 1 &$org["flags"]) ) { print "checked"; } ?>>*使用禁止 | |
| 491 | +<br> | |
| 492 | +<input type="checkbox" name=flags2 value="2" <?php if ( 0 != ( 2 &$org["flags"]) ) { print "checked"; } ?>>*信頼済(管理者のみ利用) | |
| 493 | +<br> | |
| 494 | +<input type="checkbox" name=flags4 value="4" <?php if ( 0 != ( 4 &$org["flags"]) ) { print "checked"; } ?>>操作前確認 | |
| 495 | +<br> | |
| 496 | +<input type="checkbox" name=flags8 value="8" <?php if ( 0 != ( 8 &$org["flags"]) ) { print "checked"; } ?>>#削除ファイルをバックアップ | |
| 497 | +<br> | |
| 498 | +<input type="checkbox" name=flags16 value="16" <?php if ( 0 != ( 16 &$org["flags"]) ) { print "checked"; } ?>>実行ファイル削除 | |
| 499 | +<br> | |
| 500 | +<input type="checkbox" name=flags32 value="32" <?php if ( 0 != ( 32 &$org["flags"]) ) { print "checked"; } ?>>検疫済ファイルを外部にコピー | |
| 501 | +<br> | |
| 502 | +<input type="checkbox" name=flags64 value="64" <?php if ( 0 != ( 64 &$org["flags"]) ) { print "checked"; } ?>>フォーマット | |
| 503 | +<br> | |
| 504 | +<input type="checkbox" name=flags128 value="128" <?php if ( 0 != ( 128 &$org["flags"]) ) { print "checked"; } ?>>*使用停止 | |
| 505 | +<br> | |
| 506 | +<input type="checkbox" name=flags256 value="256" <?php if ( 0 != ( 256 &$org["flags"]) ) { print "checked"; } ?>>検疫後共有公開 | |
| 507 | +<br> | |
| 508 | +<input type="checkbox" name=flags512 value="512" <?php if ( 0 != ( 512 &$org["flags"]) ) { print "checked"; } ?>>持出可(書込OK) | |
| 509 | +<br> | |
| 262 | 510 | |
| 511 | +ルールは上から順番に適用されます。*印のついているものは、そこでストップします。#印のついているものは現在使用できません | |
| 512 | +<br> | |
| 513 | +<input type="text" name=distpath value="<?php echo $org["distpath"]; ?>">コピー先PATH //SERVERNAME/DIR/PATH のように入力してください | |
| 514 | +<br> | |
| 515 | +<input type="text" name=distaccount value="<?php echo $org["distaccount"]; ?>">コピー先PATHへのユーザ名、パスワード USERNAME%PASSWORDと入力してください。必要ない場合も%のみ入力してください | |
| 516 | +<br> | |
| 263 | 517 | <input type="submit"> |
| 264 | 518 | <input type="hidden" name="id" value="<?php echo $_var["id"]; ?>"> |
| 265 | 519 | <input type="hidden" name="mode" value="regist"> |
| 266 | 520 | </form> |
| 267 | 521 | <?php |
| 268 | 522 | //----------------------------new device found mode end------------- |
| 269 | -} else if ( 1 == $_var["mode"] ) { | |
| 270 | -//----------------------------forbidden mode start------------- | |
| 271 | - print("<h1>このUSBデバイスは使用禁止です</h1>"); | |
| 272 | - | |
| 273 | - | |
| 274 | - $sql = "select * from media where id=\"".$_var["id"]."\""; | |
| 275 | - $results = mysql_db_query($db,$sql); | |
| 276 | - if (!$results) | |
| 277 | - { | |
| 278 | - print("SQL execution error"); | |
| 279 | - exit; | |
| 280 | - } | |
| 281 | - $num = mysql_num_fields($results); | |
| 523 | +} else if ( 0 == strcmp("ACTION",$_var["mode"]) ) { | |
| 524 | +//----------------------------ACTION mode start------------- | |
| 525 | + | |
| 526 | +$flags = $org["flags"]; | |
| 527 | +// print_r ($org); | |
| 528 | + $actions=""; | |
| 529 | + if ( 1 == ( 1 & $flags )) { $actions = $actions."「使用禁止」"; } | |
| 530 | + if ( 2 == ( 2 & $flags )) { $actions = $actions."「信頼済」"; } | |
| 531 | + if ( 4 == ( 4 & $flags )) { $actions = $actions."「操作前確認」"; } | |
| 532 | + if ( 8 == ( 8 & $flags )) { $actions = $actions."「削除ファイルをバックアップ」"; } | |
| 533 | + if ( 16 == ( 16 & $flags )) { $actions = $actions."「実行ファイル削除」"; } | |
| 534 | + if ( 32 == ( 32 & $flags )) { $actions = $actions."「検疫済ファイルを外部にコピー」"; } | |
| 535 | + if ( 64 == ( 64 & $flags )) { $actions = $actions."「フォーマット」"; } | |
| 536 | + if ( 128 == ( 128 & $flags )) { $actions = $actions."「使用停止」"; } | |
| 537 | + if ( 256 == ( 256 & $flags )) { $actions = $actions."「検疫後共有公開」"; } | |
| 538 | + if ( 512 == ( 512 & $flags )) { $actions = $actions."「持出可」"; } | |
| 539 | + | |
| 540 | + if ( 4 == ( 4 & $flags )) { | |
| 541 | +//----------------------------actionconfirm mode start------------- | |
| 542 | + | |
| 543 | + print("<h1>このUSBデバイスは".$actions."として設定されています</h1>"); | |
| 282 | 544 | ?> |
| 283 | - | |
| 284 | -<table border=1><tr><th></th><th>ID</th><th>名前</th><th>説明</th><th></th></tr><tr> | |
| 545 | + <b>以下のボタンを押して開始してください</b> | |
| 546 | + <form action="regist.php" method="POST"> | |
| 547 | + <input type="submit"> | |
| 548 | + <input type="hidden" name="devname" value="<?php echo $_var["devname"]; ?>"> | |
| 549 | + <input type="hidden" name="id" value="<?php echo $_var["id"]; ?>"> | |
| 550 | + <input type="hidden" name="mode" value="DOACTION"> | |
| 551 | + <input type="hidden" name="flags" value="<?php echo $_var["flags"]; ?>"> | |
| 552 | + </form> | |
| 285 | 553 | <?php |
| 286 | - while($row=mysql_fetch_array($results)) | |
| 287 | - { | |
| 288 | - for($j=0;$j<$num;$j++) | |
| 289 | - { | |
| 290 | - print("<td>".$row[$j]."</td>"); | |
| 291 | - } | |
| 292 | - } | |
| 293 | - mysql_free_result($results); | |
| 294 | - mysql_close($dbh); | |
| 295 | 554 | |
| 555 | +//----------------------------actionconfirm mode end------------- | |
| 296 | 556 | |
| 297 | -?> | |
| 557 | + } else if ( 0 != $flags ) { | |
| 558 | +//----------------------------actiondisplay mode start------------- | |
| 298 | 559 | |
| 299 | -</tr></table> | |
| 300 | -状態の変更は管理としてログインしてください | |
| 301 | -<?php | |
| 302 | -//----------------------------forbidden mode end------------- | |
| 303 | -} else if ( 2 == $_var["mode"] ) { | |
| 304 | -//----------------------------stop mode start------------- | |
| 305 | - print("<h1>このUSBデバイスは使用停止中です</h1>"); | |
| 306 | - | |
| 307 | - | |
| 308 | - $sql = "select * from media where id=\"".$_var["id"]."\""; | |
| 309 | - $results = mysql_db_query($db,$sql); | |
| 310 | - if (!$results) | |
| 311 | - { | |
| 312 | - print("SQL execution error"); | |
| 313 | - exit; | |
| 314 | - } | |
| 315 | - $num = mysql_num_fields($results); | |
| 316 | -?> | |
| 317 | - | |
| 318 | -<table border=1><tr><th></th><th>ID</th><th>名前</th><th>説明</th><th></th></tr><tr> | |
| 319 | -<?php | |
| 320 | - while($row=mysql_fetch_array($results)) | |
| 321 | - { | |
| 322 | - for($j=0;$j<$num;$j++) | |
| 323 | - { | |
| 324 | - print("<td>".$row[$j]."</td>"); | |
| 325 | - } | |
| 326 | - } | |
| 327 | - mysql_free_result($results); | |
| 328 | - mysql_close($dbh); | |
| 329 | - | |
| 330 | - | |
| 331 | -?> | |
| 332 | -</tr></table> | |
| 333 | -状態の変更は管理としてログインしてください | |
| 334 | -<?php | |
| 335 | -//----------------------------stop mode end------------- | |
| 336 | -} else if ( 4 == $_var["mode"] ) { | |
| 337 | -//----------------------------hold mode start------------- | |
| 338 | - print("<h1>このUSBデバイスの使用は保留中です</h1>"); | |
| 560 | + print("<h1>このUSBデバイスは".$actions."として設定されています</h1>"); | |
| 339 | 561 | |
| 340 | 562 | |
| 341 | 563 | $sql = "select * from media where id=\"".$_var["id"]."\""; |
| @@ -364,43 +586,97 @@ print("<h1>このUSBデバイス(".$org["nickname"].")は未登録です</h1>"); | ||
| 364 | 586 | ?> |
| 365 | 587 | |
| 366 | 588 | </tr></table> |
| 367 | -状態の変更は管理としてログインしてください | |
| 368 | -<?php | |
| 369 | -//----------------------------hold mode end------------- | |
| 370 | -} else if ( 16 == $_var["mode"] ) { | |
| 371 | -//----------------------------manual format mode start------------- | |
| 372 | - print("<h1>このUSBデバイスのフォーマットを開始します</h1>"); | |
| 373 | - | |
| 374 | - | |
| 375 | -?> | |
| 376 | - | |
| 377 | -<b>以下のボタンを押して開始してください</b> | |
| 378 | -<form action="regist.php" method="POST"> | |
| 379 | -<input type="submit"> | |
| 380 | -<input type="hidden" name="devname" value="<?php echo $_var["devname"]; ?>"> | |
| 381 | -<input type="hidden" name="id" value="<?php echo $_var["id"]; ?>"> | |
| 382 | -<input type="hidden" name="mode" value="format"> | |
| 383 | -</form> | |
| 589 | +状態の変更は管理者としてログインしてください | |
| 384 | 590 | <?php |
| 385 | -//----------------------------manual format mode end------------- | |
| 386 | -} else if ( 64 == $_var["mode"] ) { | |
| 387 | -//----------------------------manual delete mode start------------- | |
| 388 | - print("<h1>このUSBデバイスの消毒を開始します</h1>"); | |
| 389 | - | |
| 390 | -echo $_var["devname"]; | |
| 391 | -?> | |
| 591 | +//----------------------------actiondisplay mode end------------- | |
| 592 | + } | |
| 593 | +} else if ( 0 == strcmp("DOACTION", $_var["mode"])){ | |
| 594 | +//----------------------------manual action mode start -------------------- | |
| 595 | + | |
| 596 | +ob_end_flush(); | |
| 597 | + | |
| 598 | +$flags = $org["flags"]; | |
| 599 | + $actions=""; | |
| 600 | + if ( 1 == ( 1 & $flags )) { $actions = $actions."「使用禁止」"; } | |
| 601 | + if ( 2 == ( 2 & $flags )) { $actions = $actions."「信頼済」"; } | |
| 602 | + if ( 4 == ( 4 & $flags )) { $actions = $actions."「操作前確認」"; } | |
| 603 | + if ( 8 == ( 8 & $flags )) { $actions = $actions."「削除ファイルをバックアップ」"; } | |
| 604 | + if ( 16 == ( 16 & $flags )) { $actions = $actions."「実行ファイル削除」"; } | |
| 605 | + if ( 32 == ( 32 & $flags )) { $actions = $actions."「検疫済ファイルを外部にコピー」"; } | |
| 606 | + if ( 64 == ( 64 & $flags )) { $actions = $actions."「フォーマット」"; } | |
| 607 | + if ( 128 == ( 128 & $flags )) { $actions = $actions."「使用停止」"; } | |
| 608 | + if ( 256 == ( 256 & $flags )) { $actions = $actions."「検疫後共有公開」"; } | |
| 609 | + if ( 512 == ( 512 & $flags )) { $actions = $actions."「持出可」"; } | |
| 610 | + | |
| 611 | + if ( 4 == ( 4 & $flags )) { | |
| 612 | +//----------------------------actionconfirm mode start------------- | |
| 613 | + | |
| 614 | + print("<h1>このUSBデバイスは".$actions."として設定されています</h1>"); | |
| 615 | + if ( 1 == ( 1 & $flags )) { | |
| 616 | + $action = "「使用禁止」"; | |
| 617 | + print $action; | |
| 618 | +} else { | |
| 619 | + if ( 16 == ( 16 & $flags )) { | |
| 620 | + $action = "「実行ファイル削除」"; | |
| 621 | + print $action; | |
| 622 | + print "<h1>消毒中...</h1>"; | |
| 623 | + print "<pre>"; | |
| 624 | + print $_var["devname"]."\n"; | |
| 625 | + passthru("sudo mount ".$_var["devname"]." /mnt".$_var["devname"]); | |
| 626 | + //passthru("sudo mount"); | |
| 627 | + //print "-------------\n"; | |
| 628 | + passthru("sudo usbsearchdelete /mnt".$_var["devname"]); | |
| 629 | + passthru("sudo umount ".$_var["devname"]); | |
| 630 | + print "</pre>"; | |
| 631 | + } | |
| 632 | + if ( 32 == ( 32 & $flags )) { | |
| 633 | + $action = "「検疫済ファイルを外部にコピー」"; | |
| 634 | + print $action; | |
| 635 | + print "<h1>外部にコピー中...</h1>"; | |
| 636 | + print "<pre>"; | |
| 637 | + passthru("sudo mkdir -p /mnt".$_var["devname"]); | |
| 638 | + passthru("sudo mount ".$_var["devname"]." /mnt".$_var["devname"]); | |
| 639 | + passthru("sudo smbmount ".$_var["distpath"]." /mnt/$id -o username=".$_var["distaccount"]); | |
| 640 | + passthru("sudo cp -a /mnt".$_var["devname"]."/ /mnt/".$_var["id"]); | |
| 641 | + passthru("sudo umount ".$_var["devname"]); | |
| 642 | + print "</pre>"; | |
| 643 | + } | |
| 644 | + if ( 64 == ( 64 & $flags )) { | |
| 645 | + $action = "「フォーマット」"; | |
| 646 | + print $action; | |
| 647 | + print "<h1>format中...</h1>"; | |
| 648 | + print "<pre>"; | |
| 649 | + passthru("sudo mkfs.vfat ".$_var["devname"]); | |
| 650 | + passthru("sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 651 | + passthru("echo sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 652 | + #passthru("find /etc -name a*"); | |
| 653 | + print "</pre>"; | |
| 654 | + } | |
| 655 | + if ( 128 == ( 128 & $flags )) { | |
| 656 | + $action = "「使用停止」"; | |
| 657 | + print $action; | |
| 658 | + } else { | |
| 659 | + if ( 256 == ( 256 & $flags )) { | |
| 660 | + $action = "「検疫後共有公開」"; | |
| 661 | + print $action; | |
| 662 | + if ( 512 == ( 512 & $flags )) { | |
| 663 | + $action = "「持出可」"; | |
| 664 | + print $action; | |
| 665 | + passthru("sudo mount ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 666 | + } else { | |
| 667 | + passthru("sudo mount -r ".$_var["devname"]." /var/squarantine/usbstorages/".$org["nickname"]); | |
| 668 | + } | |
| 669 | + print "<h2>終了しました</h2>"; | |
| 670 | + print "<a href=\"file:".$conf["SAMBAPATH"]."\">こちらからアクセスしてください</a>"; | |
| 671 | + | |
| 672 | + } | |
| 673 | + } | |
| 674 | +} | |
| 675 | +} | |
| 676 | +} | |
| 392 | 677 | |
| 393 | -<b>以下のボタンを押して開始してください</b> | |
| 394 | -<form action="regist.php" method="POST"> | |
| 395 | -<input type="submit"> | |
| 396 | -<input type="hidden" name="devname" value="<?php echo $_var["devname"]; ?>"> | |
| 397 | -<input type="hidden" name="id" value="<?php echo $_var["id"]; ?>"> | |
| 398 | -<input type="hidden" name="mode" value="delete"> | |
| 399 | -</form> | |
| 400 | -<?php | |
| 401 | 678 | |
| 402 | -//----------------------------manual delete mode end------------- | |
| 403 | -} | |
| 679 | +//----------------------------DOACTION mode end -------------------- | |
| 404 | 680 | |
| 405 | 681 | ?> |
| 406 | 682 | </body> |
| @@ -0,0 +1 @@ | ||
| 1 | +/var/log/samba | |
| \ No newline at end of file |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | <form action="##WEBROOT##regist.php" method="POST"> |
| 18 | 18 | <input type="submit"> |
| 19 | 19 | <input type="hidden" name="id" value="##ID##"> |
| 20 | -<input type="hidden" name="mode" value="0"> | |
| 21 | -</form> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | 22 | </body> |
| 23 | 23 | </html> |
| @@ -17,7 +17,7 @@ | ||
| 17 | 17 | <form action="##WEBROOT##regist.php" method="POST"> |
| 18 | 18 | <input type="submit"> |
| 19 | 19 | <input type="hidden" name="id" value="##ID##"> |
| 20 | -<input type="hidden" name="mode" value="1"> | |
| 21 | -</form> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | 22 | </body> |
| 23 | 23 | </html> |
| @@ -0,0 +1,23 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスは使用停止中です</h1> | |
| 15 | + | |
| 16 | +<b>詳細は以下のボタンから確認してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | +</body> | |
| 23 | +</html> |
| @@ -0,0 +1,23 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスは実行ファイルの強制削除動作が登録されています</h1> | |
| 15 | + | |
| 16 | +<b>詳細は以下のボタンから確認してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="_id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | +</body> | |
| 23 | +</html> |
| @@ -0,0 +1,23 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスは信頼済み(管理者用)として登録されています</h1> | |
| 15 | + | |
| 16 | +<b>詳細は以下のボタンから確認してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="_id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | +</body> | |
| 23 | +</html> |
| @@ -0,0 +1,25 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイス中の実行ファイルを削除します</h1> | |
| 15 | + | |
| 16 | + | |
| 17 | +<b>以下のボタンを押して開始してください</b> | |
| 18 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 19 | +<input type="submit"> | |
| 20 | +<input type="hidden" name="id" value="##ID##"> | |
| 21 | +<input type="hidden" name="flags" value="64"> | |
| 22 | +<input type="hidden" name="devname" value="##DEVNAME##"> | |
| 23 | +input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 24 | +</body> | |
| 25 | +</html> |
| @@ -0,0 +1,23 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>データを転送中です</h1> | |
| 15 | + | |
| 16 | +<b>詳細は以下のボタンから確認してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="_id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | +</body> | |
| 23 | +</html> |
| @@ -0,0 +1,25 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスは##ACTION##として設定されています</h1> | |
| 15 | + | |
| 16 | + | |
| 17 | +<b>以下のボタンを押して開始してください</b> | |
| 18 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 19 | +<input type="submit"> | |
| 20 | +<input type="hidden" name="id" value="##ID##"> | |
| 21 | +<input type="hidden" name="mode" value="ACTION"> | |
| 22 | +<input type="hidden" name="devname" value="##DEVNAME##"> | |
| 23 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 24 | +</body> | |
| 25 | +</html> |
| @@ -0,0 +1,23 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスは強制フォーマットとして登録されています</h1> | |
| 15 | + | |
| 16 | +<b>詳細は以下のボタンから確認してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="_id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 22 | +</body> | |
| 23 | +</html> |
| @@ -0,0 +1,24 @@ | ||
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
| 2 | +<html lang="ja"><head> | |
| 3 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| 4 | +<title>squarantine</title> | |
| 5 | +<link rel="stylesheet" type="text/css" href="/style.css"> | |
| 6 | +</head> | |
| 7 | +<body> | |
| 8 | +<table style="border:0" width="100%"> | |
| 9 | +<tbody><tr> | |
| 10 | +<td style="border:0"><img src="/image/addr.png" alt="address"></td> | |
| 11 | +<td style="border:0"><img src="/image/logo.png" alt="Logo" align="right"></td> | |
| 12 | +</tr></tbody> | |
| 13 | +</table> | |
| 14 | +<h1>このUSBデバイスを今からフォーマットします</h1> | |
| 15 | + | |
| 16 | +<b>以下のボタンを押して開始してください</b> | |
| 17 | +<form action="##WEBROOT##regist.php" method="POST"> | |
| 18 | +<input type="submit"> | |
| 19 | +<input type="hidden" name="id" value="##ID##"> | |
| 20 | +<input type="hidden" name="mode" value="ACTION"> | |
| 21 | +<input type="hidden" name="devname" value="##DEVNAME##"> | |
| 22 | +<input type="hidden" name="flags" value="##FLAGS##"></form> | |
| 23 | +</body> | |
| 24 | +</html> |