Skip to content

Commit

Permalink
サプライヤー機能とSecret Administration Menuを実装
Browse files Browse the repository at this point in the history
  • Loading branch information
ankokuty authored and ykokubu committed Apr 26, 2018
1 parent 3d2b911 commit b7359fb
Show file tree
Hide file tree
Showing 11 changed files with 1,195 additions and 455 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Burp Suite Japan User Groupの初心者向け[ハンズオンイベント](https
オリジナルのBadStoreはisoイメージとして配布されており、実行するには仮想マシンなどからCDブートする必要があります。イベントにおいて、仮想マシンとの通信がうまくできない人が少なからずいたため、より通信トラブルが少なくなることを目的として作成しました。

# ダウンロード
[HakoniwaBadStore.jar](https://github.com/ankokuty/HakoniwaBadStore/blob/master/dist/HakoniwaBadStore.jar?raw=true)
`HakoniwaBadstore.jar`[ここ](https://github.com/ankokuty/HakoniwaBadStore/releases)からダウンロードしてください。

# 注意
箱庭BadStoreは、デモやセキュリティトレーニング目的のみで利用されることを想定している、脆弱性を意図的に作り込んだセキュアではないプログラムです。
Expand Down Expand Up @@ -38,7 +38,12 @@ Burp Suite Japan User Groupの初心者向け[ハンズオンイベント](https
オリジナルにはperlのopen関数利用によるコマンドインジェクションがありましたが、Perl固有の問題であるため箱庭BadStoreでは実装していません。

- [その他]
サプライヤー機能については、まだ実装できていません。
次の機能は実装していません。
- SOAP Updates
- Secret Administration Menu
- Troubleshooting
- Supply Chain: Manage Open Orders
- Supply Chain: Check Credit with Supplier

# ライセンス
GNU GPL v2.0 またはそれ以降
Expand Down
Binary file removed dist/HakoniwaBadStore.jar
Binary file not shown.
6 changes: 3 additions & 3 deletions src/main/java/badstore/BSHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void handle(RoutingContext context) {

String action = context.request().getParam("action");
if (action != null && action.equals("cartadd")) {
cartAdd(context);
cartadd(context);
} else {
/* Read CartID Cookie */
Cookie ctemp = context.getCookie("CartID");
Expand All @@ -45,7 +45,7 @@ public void handle(RoutingContext context) {
output(context);
}

private void cartAdd(RoutingContext context) {
private void cartadd(RoutingContext context) {
HttpServerRequest request = context.request();
HttpServerResponse response = context.response();
String sessid = Long.toString((new Date().getTime() / 1000));
Expand Down Expand Up @@ -86,7 +86,7 @@ private void cartAdd(RoutingContext context) {
// Create initial CartID cookie
String cookievalue = String.join(":",
new String[] { sessid, Integer.toString(_items), Float.toString(cost), cartitem });
Cookie cartcookie = Cookie.cookie("CartID", cookievalue);
Cookie cartcookie = Cookie.cookie("CartID", url_encode(cookievalue));
cartcookie.setPath("/");
items = Integer.toString(_items);
price = String.format("$%.2f", cost);
Expand Down
63 changes: 63 additions & 0 deletions src/main/java/badstore/BackupFileHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package badstore;

import static io.netty.handler.codec.http.HttpResponseStatus.NOT_FOUND;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.impl.Utils;

public class BackupFileHandler extends FileHandler {
@Override
public void handle(RoutingContext context) {
String path = Utils.removeDots(Utils.urlDecode(context.normalisedPath(), false));
if (path == null) {
context.fail(NOT_FOUND.code());
return;
}

HttpServerResponse response = context.response();
if (path.equals("/backup/")) {
response.setChunked(true);
if (BadStore.orderdb_bak.exists()) {
response.write("orderdb.bak\n");
}
if (BadStore.userdb_bak.exists()) {
response.write("userdb.bak\n");
}
} else {
File file = null;
if (path.equals("/backup/orderdb.bak")) {
file = BadStore.orderdb_bak;
} else if (path.equals("/backup/userdb.bak")) {
file = BadStore.userdb_bak;
}
if (file == null || !file.exists()) {
context.fail(NOT_FOUND.code());
return;
}

InputStream is = null;
try {
is = new FileInputStream(file);
output(context, is, "text/plain");
} catch (FileNotFoundException e) {
context.fail(NOT_FOUND.code());
return;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ignore) {
}
}
}
}
response.end();
}
}
Loading

0 comments on commit b7359fb

Please sign in to comment.