• ベストアンサー

pythonのエラー

# content = r.content if status_code == 200: if( if b"<a href='function.main'>function.main</a>" not in content: and "[<a href='function.include'>function.include</a>" not in content and ("Failed opening" not in content and "for inclusion" not in content) and "failed to open stream:" not in content and "open_basedir restriction in effect" not in content and ( "root:" in content or ("sbin" in content and "nologin" in content) or "DB_NAME" in content or "daemon:" in content or "DOCUMENT_ROOT=" in content or "PATH=" in content or "HTTP_USER_AGENT" in content or "HTTP_ACCEPT_ENCODING=" in content or "users:x" in content or ( "GET /" in content and ("HTTP/1.1" in content or "HTTP/1.0" in content) ) or "apache_port=" in content or "cpanel/logs/access" in content or "allow_login_autocomplete" in content or "database_prefix=" in content or "emailusersbandwidth" in content or "adminuser=" in content or ( "error]" in content and "[client" in content and "log" in website ) or ( "[error] [client" in content and "File does not exist:" in content and "proc/self/fd/" in website ) or ( "State: R (running)" in content and ( "Tgid:" in content or "TracerPid:" in content or "Uid:" in content ) and "/proc/self/status" in website ) ) ): エラーは、 File "/home/kali/LFISuite/lfisuite.py", line 2382 if b"<a href='function.main'>function.main</a>" not in content: ^^ SyntaxError: invalid syntax ここら辺がおかしいらしいのですが、よく解りません。 他の所もおかしい気がしたのでその部分を抜粋しました。 ご教示宜しくお願い致します。

質問者が選んだベストアンサー

  • ベストアンサー
  • _kappe_
  • ベストアンサー率68% (1532/2231)
回答No.1

"if status_code == 200:"を2行目として数えた場合、3行目の"if("のカッコは49行目の"):"のカッコと対応しています。つまり、4行目から48行目が表す内容が3行目のifの条件式になっている必要があるのですが、4行目から48行目は式の形になっていないので文法エラーが出るのは当然です。 そもそも、一つの条件式を40行以上かけて書くのはとても読みづらく、センスがないと言っていいでしょう。意味のある部分ごとに関数を作って式の構造を把握しやすくするのが普通だと思います。 4行目の"if b"を消せば文法的には解決しそう(確認はしていない)ですが、何をしたいのかが不明なのでそれが正しい直し方かどうかは分かりません。

JackTheRipper99
質問者

お礼

回答ありがとうございます、 これは元からあるソースコードです。 LFISuiteと言われるペネトレーションテスト用のコードです。

全文を見る
すると、全ての回答が全文表示されます。

関連するQ&A

  • python

    もしも...と.t もしくは .oもしくは .nもしくは.q もしくは.sもしくは.fもしくは.jが同じ行に含まれていたらという条件分岐を書きたいのですが以下のようでは上手くいきません。どのように書いたらよいでしょうか。よろしくお願いします。 if "..."in line and ".t "or ".o"or ".n"or".q "or".s"or ".f "or ".j "in line:

  • PHPエラーコードについて

    このようなエラーの場合どうすればいいのでしょうか?どなたか宜しくお願いいたします。 Warning: main(pager/pager.php) [function.main]: failed to open stream: No such file or directory in /home/○○○○/public_html/server/app/○○○○/○○○○.php on line 10 Fatal error: main() [function.require]: Failed opening required 'pager/pager.php' (include_path='../../pear:../../smarty:.:/usr/local/lib/php') in /home/○○○○/public_html/server/app/○○○○/○○○○.php on line 10

    • 締切済み
    • PHP
  • MySQL5.0のストアドプロシージャで引数の使い方がわからなくて困っています。

    MySQL5.0のストアドプロシージャで引数の使い方がわからなくて困っています。 ストアドプロシージャで IF文で引数の空の判定と、 LIKE '%name%'にその引数を使いたいのです。 どなたかわかるかたいらっしゃいませんか? □プログラムからコールする strSQL = "CALL buttonaction_proc2(syohinCd, syohinCdLast, name, count) "; □ストアドプロージャ delimiter // CREATE PROCEDURE buttonaction_proc2(IN syohinCd INT(8), IN syohinCdLast INT(8), IN name VARCHAR(40), IN count INT(8)) IF ((syihinCd IS NOT NULL) OR (syohinCdLast IS NOT NULL) OR (name IS NOT NULL)) THEN AND (SYOHIN_CD BETWEEN syohinCd AND syohinCdLast) ELSE (IF syohinCd IS NOT NULL) THEN AND (SYOHIN_CD BETWEEN syohinCd AND count) ELSE IF (syohinCdLast IS NOT NULL) THEN ( AND (SYOHIN_CD BETWEEN 1 AND syohinCdLast) ) IF (name IS NOT NULL) THEN AND NAME LIKE '%name%' END IF END IF ORDER BY SYOHIN_CD; END //

  • クロールしたときのエラー対処について

    これまで同じプログラムで稼動していたのに、つい最近動かしたら下記エラーが出てしまいました、、 Warning: fopen(http://www.AAA.jp/ここはパラメータが入ってます。) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error in C:\xampp\htdocs\phpget\get2.php on line 4 line 4 に記述されているもの ↓ function getURL( $pURL ) { $_data = null; if( $_http = fopen( $pURL, "r" ) ) {   ←ここが4行目 while( !feof( $_http ) ) { $_data .= fgets( $_http, 1024 ); } fclose( $_http ); } return( $_data ); } これは、クロール先のサーバ側が何らかの設定変更によるものでしょうか? こちらで対処できる方法があれば教えていただきたく よろしくお願いします。

    • 締切済み
    • PHP
  • biginTransaction();でエラー??

    いつも大変お世話になり誠にありがとうございます。 私は、おっしゃる通り、理解しながらやっていないです。 でも、自分なりに理解できるところは為になっております。 皆様のおかげです。 標記の件。 エラーメッセージは ( ! ) Fatal error: Uncaught Error: Call to undefined method PDO::biginTransaction() in /srv/www/htdocs/blog.php on line 30 ( ! ) Error: Call to undefined method PDO::biginTransaction() in /srv/www/htdocs/blog.php on line 30 です。 どう直せばいいでしょうか? どうか教えてください。 宜しくお願い申し上げます。      記 <?php require_once('dbc.php'); class Blog extends Dbc { protected $table_name = 'blog'; //カテゴリー名を表示 //引数:数字 //返り値:カテゴリーの文字列 public function setCategoryName($category) { if ($category == '1') { return '日常'; } elseif ($category == '2') { return '非日常'; } else { return 'その他'; } } public function blogCreate($blogs) { $sql = "INSERT INTO blog(title,content,category,publish_status) VALUES (:title, :content, :category, :publish_status)"; $dbh = $this->dbConnect(); $dbh->biginTransaction(); try { $stmt = $dbh->prepare($sql); $stmt->bindValue(':title', $blogs['title'], PDO::PARAM_STR); $stmt->bindValue(':content', $blogs['content'], PDO::PARAM_STR); $stmt->bindValue(':category', $blogs['category'], PDO::PARAM_INT); $stmt->bindValue(':publish_status', $blogs['publish_status'], PDO::PARAM_INT); $stmt->bindValue(':id', $blogs['id'], PDO::PARAM_INT); $stmt->execute(); $stmt->commit(); echo 'ブログを投稿しました!'; } catch (PDOException $e) { $dbh->rollBack(); exit($e); } function blogUpdate($blogs) { $sql = "UPDATE $this->table_name SET title = :title, content = :content, category = :category, publish_status = :publish_status Where id = :id"; $dbh = dbConnect(); $dbh->biginTransaction(); try { $stmt = $dbh->prepare($sql); $stmt->bindValue(':title', $blogs['title'], PDO::PARAM_STR); $stmt->bindValue(':content', $blogs['content'], PDO::PARAM_STR); $stmt->bindValue(':category', $blogs['category'], PDO::PARAM_INT); $stmt->bindValue(':publish_status', $blogs['publish_status'], PDO::PARAM_INT); $stmt->bindValue(':id', $blogs['id'], PDO::PARAM_INT); $stmt->execute(); $stmt->commit(); echo 'ブログを更新しました!'; } catch (PDOException $e) { $dbh->rollBack(); exit($e); } } function blogUpdate($blogs){ } //ブログのバリデーション function blogValidate($blogs) { if (empty($blogs['title'])) { exit('タイトルを入力してください。'); } if (mb_strlen($blogs['title']) > 191) { exit('タイトルは191文字以下にしてください。'); } if (empty($blogs['content'])) { exit('本文を入力してください。'); } if (empty($blogs['category'])) { exit('カテゴリーは必須です。'); } if (empty($blogs['publish_status'])) { exit('公開ステータスは必須です。'); } } } } ?>

    • ベストアンサー
    • PHP
  • openPNE のPHPエラーについて教えて下さい。

    openPNE のOpenPNE-2.6RC2.1を設置しました。 すると、以下のエラーがでます。 どこがいけないのでしょうか? 一応、config.php や config.inc.php は修正して アップロードされております。 <エラー内容> http://ドメイン/?m=setup http://ドメイン http://ドメイン/?m=admin 上記のURLで、以下の様になります。 Warning: main(アップロードディレクトリ/config.php) [function.main]: failed to open stream: No such file or directory in アップロードディレクトリ/config.inc.php on line 8 Fatal error: main() [function.require]: Failed opening required 'アップロードディレクトリ/config.php' (include_path='.:/usr/local/lib/php') in アップロードディレクトリ/config.inc.php on line 8

    • ベストアンサー
    • PHP
  • python で キャラスイッチ

    こんにちは、Pythonで、Characterの交換をしたいのですが、 例えば、a = "ABCBBEECCDD" だとで、BとCに変え、CをBに変える といったようなファンクションを書かなければなりません。 その場合、Ifとかループとかは使用してはならないと言う決まりなのですが、 やはり replace を使用すべきなのだろうと思ったのですが・・・。 a.replace("B","C") を使い、後に a.replace("B","C") にすると、 全部がCになってしまいますよね?IFを持ちいらずに、これらを交換する事はできるのでしょうか。Or と And 等は使用しても良い事になっております。("B" , "C") = ("C", "B") というような方法も考えたのですが、 それですと、どれだけ長いのかも解らないStringを一つ一つのCharに分解しなければなりません。どうしたらよいのか解らなくて立ち往生状態です。 課題なので、ヒントを頂ければと思います。宜しくお願いします。

  • WindowsMediaPlayer11のエラーについて

    ネット上の動画をダウンロードしてWindowsMediaPlayer11で再生すると『ファイルの再生中に Windows Media Player に問題が発生しました。詳細については、[Web ヘルプ] をクリックしてください。』とポップアップが表示されます。(そのサイトにある他の動画は問題なく再生出来ます)『ヘルプ』をクリックすると『Windows Media Player Error Message Help You've encountered error message C00D11B1 while using Windows Media Player. The following information might help you troubleshoot the issue. 』などと書かれたIEが開きます。その下には『Cannot play the file Windows Media Player cannot play the file. You might encounter this error message for one of the following reasons: Your sound device, such as a sound card or sound controller, requires an updated driver. To determine if an updated driver is available, see Windows Update at the Microsoft Web site, or see the sound device manufacturer's Web site. Your sound device is not functioning properly. Try using Device Manager to check the status of your sound device. To check the status of your sound device Do one of the following: If you are running Windows XP, click Start, right-click My Computer, and then click Manage. If you are running Windows Vista, click Start, right-click Computer, and then click Manage. In the pane on the left, click Device Manager. In the pane on the right, expand Sound, video and game controllers, and then look for the name of your sound device. Do one of the following: If your sound device is listed but the icon includes a red "X," the device has been disabled. To enable the device, right-click the icon, and then click Enable. If your sound device is not listed, in the pane on the right, expand Other devices. If Multimedia Audio Controller appears in the list, right-click the icon, and then click Update Driver or Update Driver Software. Follow the on-screen instructions to find and install the driver software. If you are not able to find and install the correct driver software, see your computer manufacturer's or sound device manufacturer's Web site for further assistance. You do not have a sound device installed on your computer. Install a sound device, and then try to play the file again. For details, see your computer manufacturer's or sound device manufacturer's Web site. You are trying to play a file on the Internet and the server might be temporarily unavailable or there might be a network issue. Try again later. You are trying to play an MP3 file that contains compressed ID3 headers. The ID3 header is a portion of the file that stores the song's album information (for example, the song name, artist name, album name, and genre). This information is sometimes called a "tag." To fix the problem, make a copy of the file and then use a non-Microsoft ID3 tag editing program to remove or reset the file's ID3 headers. After you remove the ID3 headers, Windows Media Player should be able to play the MP3 file. Attempting to remove ID3 headers might damage the file and make it unplayable. Therefore, always make a copy of the file before you edit it. If this solution does not resolve the problem, the file might be corrupted.』と書かれていますが英語なのでさっぱりわかりません。 『http://d.hatena.ne.jp/ingo/20070307/p1』に解決策が載っていたので試したが効果ありませんでした。 どなたか解決策を教えて下さい。WindousXPです。

  • ストアドプロシージャーでループするとエラー

    ストアドプロシージャーを空の行をつくるために、ループさせようとしていますが、エラーがでます。 #1313 - RETURN is only allowed in a FUNCTION 書いたソースです。 delimiter | CREATE PROCEDURE looptest(OUT param1 INT) begin declare cnt int default 0; declare result varchar(255) default seed; lbl : loop set cnt =cnt +1; if cnt >= param1 then leave lbl; else INSERT INTO `wp_base_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) VALUES (NULL, '0', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '', '', 'draft', 'open', 'open', '', '', '', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', '0', '', '0', 'page', '', '0'); end if; end loop lbl; return result; END | delimiter; call looptest; #1313 - RETURN is only allowed in a FUNCTION

  • この状態はどういう意味でしょうか?

    おとといまで普通に見れたサイトがこのような表示のまま2日たちました。これはどういう意味なのでしょうか?閉鎖という意味なんでしょうか?ちなみに普通の音楽情報サイトです。自分なりに訳すのは、一時的な休止?のようにもとれました・・・正しい訳をおしえてください Warning: file_get_contents(​http://ecs.amazonaws.jp/onca/xml?Service=AWSECommerceService&AW...​ failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in /lvm09/vuser03/3/8/0050683/​www.@@@@@@@@.jp/main/pcapi.php​ on line 136 Fatal error: Call to a member function on a non-object in /lvm09/vuser03/3/8/0050683/​www.@@@@@@@@.jp/main/pcapi.php​ on line 142

このQ&Aのポイント
  • PX-M6711FTでPCから印刷をすると、先頭のページの直前及び最後のページの後で、トレイ2の紙が白紙で排出される現象が起こっています。
  • トレイ2を抜いておくと、印刷できない等のエラーもなくA4が正常に印刷されるだけとなります。
  • プリンタをリセットやプリンタドライバの再インストールを行っても状態に変化はありませんでした。
回答を見る