Skip to content

Commit

Permalink
DNS work
Browse files Browse the repository at this point in the history
  • Loading branch information
lennartkoopmann committed Jun 6, 2024
1 parent cacb48a commit d691e8b
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,29 @@ public Response transactionLog(@Context SecurityContext sc,
return Response.ok(DNSLogListResponse.create(total, transactions)).build();
}

@GET
@Path("/transactions/charts/charts")
public Response transactionCharts(@Context SecurityContext sc,
@QueryParam("time_range") @Valid String timeRangeParameter,
@QueryParam("limit") int limit,
@QueryParam("offset") int offset,
@QueryParam("taps") String tapIds) {
List<UUID> taps = parseAndValidateTapIds(getAuthenticatedUser(sc), nzyme, tapIds);

TimeRange timeRange = parseTimeRangeQueryParameter(timeRangeParameter);
Bucketing.BucketingConfiguration bucketing = Bucketing.getConfig(timeRange);

// for query, response, both
// create GenericNumberBucket

/*
SELECT date_trunc('hour', timestamp) AS bucket,
COUNT(*) AS count FROM dns_log
GROUP BY bucket ORDER BY bucket DESC
*/

}

private DNSLogDataResponse logToResponse(DNSLogEntry log) {
return DNSLogDataResponse.create(
log.uuid(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import moment from "moment/moment";
import numeral from "numeral";
import DNSData from "../DNSData";
import ETLD from "../../shared/ETLD";
import DNSEntropyLogResponseTable from "./DNSEntropyLogResponseTable";
import L4Address from "../../shared/L4Address";
import DNSLogResponseTable from "../shared/DNSLogResponseTable";

export default function DNSEntropyLogTableRow(props) {

Expand Down Expand Up @@ -41,7 +41,7 @@ export default function DNSEntropyLogTableRow(props) {
<td title={log.zscore}>{numeral(log.zscore).format("0,0.0")}</td>
</tr>

<DNSEntropyLogResponseTable responses={log.responses} show={showResponses}/>
<DNSLogResponseTable responses={log.responses} show={showResponses}/>
</React.Fragment>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import DNSData from "../DNSData";
import moment from "moment";
import ETLD from "../../shared/ETLD";
import L4Address from "../../shared/L4Address";
import DNSEntropyLogResponseTable from "../entropy/DNSEntropyLogResponseTable";
import DNSLogResponseTable from "../shared/DNSLogResponseTable";

export default function DNSTransactionLogTableRow(props) {

Expand Down Expand Up @@ -36,9 +36,8 @@ export default function DNSTransactionLogTableRow(props) {
<td><L4Address address={log.query.server} /></td>
</tr>

<DNSEntropyLogResponseTable responses={log.responses} show={showResponses}/>
<DNSLogResponseTable responses={log.responses} show={showResponses}/>
</React.Fragment>
)


}
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,16 @@ export default function DNSTransactionLogsPage() {
</nav>
</div>

<div className="col-md-12">
<h1>
DNS Transaction Logs
</h1>
<div className="col-12">
<div className="card">
<div className="card-body">
<CardTitleWithControls title="DNS Transaction Logs"
timeRange={timeRange}
setTimeRange={setTimeRange}
slim={true} />

</div>
</div>
</div>
</div>

Expand All @@ -47,8 +53,7 @@ export default function DNSTransactionLogsPage() {
<div className="card">
<div className="card-body">
<CardTitleWithControls title="Transactions"
timeRange={timeRange}
setTimeRange={setTimeRange} />
fixedAppliedTimeRange={timeRange} />

<Filters filters={filters} setFilters={setFilters} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import React, {useContext, useEffect, useState} from "react";
import {TapContext} from "../../../../App";
import DNSService from "../../../../services/ethernet/DNSService";
import GenericWidgetLoadingSpinner from "../../../widgets/GenericWidgetLoadingSpinner";
import DNSEntropyLogTableRow from "../entropy/DNSEntropyLogTableRow";
import Paginator from "../../../misc/Paginator";
import DNSTransactionLogTableRow from "./DNSTransactionLogTableRow";

import numeral from "numeral";

const dnsService = new DNSService();

export default function DNSTransactionsTable(props) {
Expand Down Expand Up @@ -36,7 +37,11 @@ export default function DNSTransactionsTable(props) {

return (
<React.Fragment>
<table className="table table-sm table-hover table-striped mb-4 mt-3">
<p className="mb-2 mt-2">
<strong>Total:</strong> {numeral(data.total).format("0,0")}
</p>

<table className="table table-sm table-hover table-striped mb-4">
<thead>
<tr>
<th>Query</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ETLD from "../../shared/ETLD";

const COLSPAN = 8;

export default function DNSEntropyLogResponseTable(props) {
export default function DNSLogResponseTable(props) {

const responses = props.responses;
const show = props.show;
Expand Down

0 comments on commit d691e8b

Please sign in to comment.