-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26ef3d6
commit 04d6b01
Showing
10 changed files
with
265 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/java/horse/wtf/nzyme/dot11/deauth/db/DeauthenticationMonitorRecording.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* This file is part of nzyme. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the Server Side Public License, version 1, | ||
* as published by MongoDB, Inc. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Server Side Public License for more details. | ||
* | ||
* You should have received a copy of the Server Side Public License | ||
* along with this program. If not, see | ||
* <http://www.mongodb.com/licensing/server-side-public-license>. | ||
*/ | ||
|
||
package horse.wtf.nzyme.dot11.deauth.db; | ||
|
||
import com.google.auto.value.AutoValue; | ||
import org.joda.time.DateTime; | ||
|
||
@AutoValue | ||
public abstract class DeauthenticationMonitorRecording { | ||
|
||
public abstract Long totalFrameCount(); | ||
public abstract DateTime createdAt(); | ||
|
||
public static DeauthenticationMonitorRecording create(Long totalFrameCount, DateTime createdAt) { | ||
return builder() | ||
.totalFrameCount(totalFrameCount) | ||
.createdAt(createdAt) | ||
.build(); | ||
} | ||
|
||
public static Builder builder() { | ||
return new AutoValue_DeauthenticationMonitorRecording.Builder(); | ||
} | ||
|
||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
public abstract Builder totalFrameCount(Long totalFrameCount); | ||
|
||
public abstract Builder createdAt(DateTime createdAt); | ||
|
||
public abstract DeauthenticationMonitorRecording build(); | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
src/main/java/horse/wtf/nzyme/dot11/deauth/db/DeauthenticationMonitorRecordingMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* This file is part of nzyme. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the Server Side Public License, version 1, | ||
* as published by MongoDB, Inc. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* Server Side Public License for more details. | ||
* | ||
* You should have received a copy of the Server Side Public License | ||
* along with this program. If not, see | ||
* <http://www.mongodb.com/licensing/server-side-public-license>. | ||
*/ | ||
|
||
package horse.wtf.nzyme.dot11.deauth.db; | ||
|
||
import horse.wtf.nzyme.database.Database; | ||
import org.jdbi.v3.core.mapper.RowMapper; | ||
import org.jdbi.v3.core.statement.StatementContext; | ||
import org.joda.time.DateTime; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
public class DeauthenticationMonitorRecordingMapper implements RowMapper<DeauthenticationMonitorRecording> { | ||
|
||
@Override | ||
public DeauthenticationMonitorRecording map(ResultSet rs, StatementContext ctx) throws SQLException { | ||
return DeauthenticationMonitorRecording.create( | ||
rs.getLong("total_frame_count"), | ||
DateTime.parse(rs.getString("created_at"), Database.DATE_TIME_FORMATTER_WITH_ZONE) | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from 'react'; | ||
|
||
import Plot from 'react-plotly.js'; | ||
|
||
class SimpleBarChart extends React.Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
data: props.data | ||
}; | ||
} | ||
|
||
componentWillReceiveProps(nextProps) { | ||
this.setState({ data: nextProps.data }); | ||
} | ||
|
||
render() { | ||
let x = []; | ||
let y = []; | ||
|
||
const data = this.state.data; | ||
|
||
let finalData = this.props.finalData; | ||
if (!finalData) { | ||
Object.keys(data).forEach(function (key) { | ||
x.push(new Date(key)); | ||
y.push(data[key]); | ||
}); | ||
|
||
finalData = [ | ||
{ | ||
x: x, | ||
y: y, | ||
type: "bar", | ||
line: {width: 1, shape: "linear", color: "#2983fe"}, | ||
} | ||
]; | ||
} | ||
|
||
let marginLeft = this.props.customMarginLeft ? this.props.customMarginLeft : 25; | ||
let marginRight = this.props.customMarginRight ? this.props.customMarginRight : 0; | ||
let marginTop = this.props.customMarginTop ? this.props.customMarginTop : 25; | ||
let marginBottom = this.props.customMarginBottom ? this.props.customMarginBottom : 50; | ||
|
||
return ( | ||
<Plot | ||
style={{ width: '100%', height: '100%' }} | ||
data={finalData} | ||
layout={{ | ||
height: this.props.height, | ||
width: this.props.width, | ||
font: { | ||
family: "'Inconsolata', monospace", | ||
size: 10, | ||
color: this.props.textColor ? this.props.textColor : "#ffffff" | ||
}, | ||
margin: { l: marginLeft, r: marginRight, b: marginBottom, t: marginTop, pad: 0 }, | ||
title: { text: this.props.title }, | ||
paper_bgcolor: this.props.backgroundColor ? this.props.backgroundColor : "#0c0d16", | ||
plot_bgcolor: this.props.backgroundColor ? this.props.backgroundColor : "#0c0d16", | ||
showlegend: false, | ||
dragmode: false, | ||
clickmode: "none", | ||
hovermode: this.props.disableHover ? false : "x", | ||
hoverlabel: { | ||
font: { size: 11 }, | ||
namelength: -1 | ||
}, | ||
barmode: "stack", | ||
boxgap: 0, | ||
xaxis: { | ||
fixedrange: true, | ||
title: this.props.xaxistitle, | ||
zerolinecolor: "#1f2134", | ||
linecolor: "#11121f", | ||
gridcolor: "#1f2134" | ||
}, | ||
yaxis: { | ||
fixedrange: true, | ||
title: this.props.yaxistitle, | ||
zerolinecolor: "#1f2134", | ||
linecolor: "#11121f", | ||
gridcolor: "#1f2134" | ||
}, | ||
annotations: this.props.annotations ? this.props.annotations : [], | ||
shapes: this.props.shapes | ||
}} | ||
config={{ | ||
displayModeBar: false, | ||
autosize: true, | ||
responsive: true | ||
}} | ||
/> | ||
) | ||
} | ||
|
||
} | ||
|
||
export default SimpleBarChart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.