Skip to content

Commit

Permalink
ui: remove increment parameter as not used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
safchain committed Sep 24, 2019
1 parent 2b128b1 commit 0d6255b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cmd/injector/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func AddInjectPacketInjectFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&payload, "payload", "", "", "payload")
cmd.Flags().StringVar(&pcap, "pcap", "", "PCAP file")
cmd.Flags().Uint16VarP(&id, "id", "", 0, "ICMP identification")
cmd.Flags().IntVarP(&mode, "mode", "", types.PIModeRandom, "specify type of modification between injections")
cmd.Flags().IntVarP(&mode, "mode", "", types.PIModeUniqPerNode, "specify type of modification between injections")
cmd.Flags().Int64VarP(&incrementPayload, "inc-payload", "", 0, "increase payload size each packet")
cmd.Flags().Uint64VarP(&count, "count", "", 1, "number of packets to be generated")
cmd.Flags().Uint64VarP(&interval, "interval", "", 0, "wait interval milliseconds between sending each packet")
Expand Down
32 changes: 11 additions & 21 deletions statics/js/components/inject-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,29 +56,22 @@ Vue.component('inject-form', {
<label for="inject-count">ICMP ID</label>\
<input id="inject-id" type="number" class="form-control input-sm" v-model.number="id" min="0" />\
</div>\
<div class="form-group">\
<label class="form-check-label">\
<input id="inject-increment" type="checkbox" class="form-check-input" v-model="increment">\
Increment ID at every packet\
<span class="checkmark"></span>\
</label>\
</div>\
</div>\
<div class="form-group form-inline">\
<label class="radio-inline">\
<input type="radio" id="random" value="random" v-model="mode"> Payload Length\
<input type="radio" id="random" value="random" v-model="payloadMode"> Payload Length\
<span class="checkmark"></span>\
</label>\
<label class="radio-inline">\
<input type="radio" id="custom" value="custom" v-model="mode"> Payload\
<input type="radio" id="custom" value="custom" v-model="payloadMode"> Payload\
<span class="checkmark"></span>\
</label>\
</div>\
<div class="form-group" v-if="mode == \'random\'">\
<div class="form-group" v-if="payloadMode == \'random\'">\
<label for="payload-length">Payload length</label>\
<input id="payload-length" type="number" class="form-control input-sm" v-model.number="payloadlength" min="0" />\
<input id="payload-length" type="number" class="form-control input-sm" v-model.number="payloadLength" min="0" />\
</div>\
<div class="form-group" v-if="mode == \'custom\'">\
<div class="form-group" v-if="payloadMode == \'custom\'">\
<label for="payld">Payload</label>\
<input id="payld" type="text" class="form-control input-sm" v-model="payload"/>\
</div>\
Expand Down Expand Up @@ -118,17 +111,16 @@ Vue.component('inject-form', {
type: "icmp4",
id: 0,
interval: 0,
increment: false,
port1: 0,
port2: 0,
payloadlength: 0,
payloadLength: 0,
srcNode: null,
dstNode: null,
srcIP: "",
dstIP: "",
srcMAC: "",
dstMAC: "",
mode: "random",
payloadMode: "random",
payload: "",
incrementPayload: 0,
ttl: 64,
Expand Down Expand Up @@ -237,15 +229,14 @@ Vue.component('inject-form', {
},

reset: function() {
var self = this;
this.node1 = this.node2 = "";
this.count = 1;
this.type = "icmp4";
this.payloadlength = this.incrementPayload = 0;
this.payloadLength = this.incrementPayload = 0;
this.srcNode = this.dstNode = null;
this.srcIP = this.dstIP = "";
this.srcMAC = this.dstMAC = "";
this.mode = "random";
this.payloadMode = "random";
this.payload = "";
this.ttl = 64;
},
Expand All @@ -256,8 +247,8 @@ Vue.component('inject-form', {
this.$error({message: this.error});
return;
}
if (this.mode == "random") {
this.payload = "x".repeat(this.payloadlength);
if (this.payloadMode == "random") {
this.payload = "x".repeat(this.payloadLength);
}
var requestTTL = this.interval*this.count;
var headers = {"X-Resource-TTL": requestTTL + 5000 + "ms"};
Expand All @@ -276,7 +267,6 @@ Vue.component('inject-form', {
"Type": this.type,
"Count": this.count,
"ICMPID": this.id,
"Increment": this.increment,
"Interval": this.interval,
"Payload": this.payload,
"IncrementPayload": this.incrementPayload,
Expand Down

0 comments on commit 0d6255b

Please sign in to comment.