-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgrade node to 20 to fix fcking npm error npm/cli#4589
- Loading branch information
Showing
16 changed files
with
174 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
FROM golang:buster AS builder | ||
|
||
# RUN apk add build-base | ||
RUN GO111MODULE=on go install github.com/jaeles-project/jaeles@latest | ||
# RUN GO111MODULE=on go install github.com/jaeles-project/jaeles@latest | ||
|
||
FROM node:16-buster AS final | ||
WORKDIR /root | ||
|
||
RUN git clone https://github.com/jaeles-project/jaeles.git | ||
RUN cd jaeles && sed -i "s/StringSliceVarP/StringArrayVarP/g" "./cmd/root.go" && go mod download | ||
RUN cd jaeles && go get github.com/chromedp/chromedp && go get github.com/mattn/go-isatty | ||
RUN cd jaeles && go build main.go | ||
|
||
FROM node:20-buster AS final | ||
|
||
WORKDIR /app | ||
|
||
RUN apt update -y && apt install ripgrep | ||
|
||
COPY --from=builder /go/bin/jaeles /bin/jaeles | ||
COPY --from=builder /root/jaeles/main /bin/jaeles | ||
COPY ./signatures/ ./signatures/ | ||
RUN jaeles config reload --signDir /app/signatures/ && mkdir -p /files/scan-logs/ | ||
|
||
CMD npm i && npm run start:dev |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,52 +1,43 @@ | ||
import { Model } from 'mongoose'; | ||
import { Injectable, Logger } from '@nestjs/common'; | ||
import { InjectModel } from '@nestjs/mongoose'; | ||
|
||
import { Path, PathDocument } from 'libs/schemas/path.schema'; | ||
import { User, UserDocument } from 'libs/schemas/user.schema'; | ||
import { Project, ProjectDocument } from 'libs/schemas/project.schema'; | ||
import { RawPacket, RawPacketDocument } from 'libs/schemas/raw_packet.schema'; | ||
import { Occurence, OccurenceDocument } from 'libs/schemas/occurence.schema'; | ||
import path from 'path'; | ||
import { ScanRun } from 'libs/schemas/scan_run.schema'; | ||
import { exec } from '@drstrain/drutil'; | ||
import { ScanRunDetail } from 'libs/schemas/scan_run.schema'; | ||
import { exec, system } from '@drstrain/drutil'; | ||
|
||
function escapeShellArg(arg) { | ||
return `'${arg.replace(/'/g, `'\\''`)}'`; | ||
} | ||
|
||
function getScannerLogLocation(id: string): string { | ||
const fileLocation = path.join('/files', 'scan-logs', id); | ||
return fileLocation; | ||
} | ||
@Injectable() | ||
export class JaelesService { | ||
private logger = new Logger(JaelesService.name); | ||
|
||
constructor( | ||
@InjectModel(RawPacket.name) | ||
private rawPacketModel: Model<RawPacketDocument>, | ||
@InjectModel(Path.name) private pathModel: Model<PathDocument>, | ||
@InjectModel(Occurence.name) | ||
private occurenceModel: Model<OccurenceDocument>, | ||
@InjectModel(Project.name) private projectModel: Model<ProjectDocument>, | ||
@InjectModel(User.name) private userModel: Model<UserDocument>, | ||
) {} | ||
|
||
getScannerLogLocation(id: string): string { | ||
const fileLocation = path.join('/files', 'scan-logs', id); | ||
return fileLocation; | ||
} | ||
|
||
async runJaelesScan(scanRun: ScanRun) { | ||
const packet = await this.rawPacketModel.findOne({ | ||
requestPacketId: scanRun.requestPacketId, | ||
}); | ||
if (!packet) return; | ||
|
||
async runJaelesScan(scanRunDetail: ScanRunDetail) { | ||
const { packet } = scanRunDetail; | ||
const url = `${packet.origin}${packet.path}${ | ||
packet.querystring ? '?' + packet.querystring : '' | ||
}`; | ||
|
||
const headerArgs = packet.requestHeaders.slice(1).reduce((prev, cur) => { | ||
return [...prev, '-H', cur]; | ||
}, []); | ||
|
||
console.log(url); | ||
console.log(headerArgs); | ||
|
||
// const { stdout } = await exec('jaeles', ['scan', '-u', url, ...headerArgs]); | ||
return prev + ` -H ${escapeShellArg(cur)}`; | ||
}, ''); | ||
|
||
const cmd = `/bin/jaeles scan -u '${url}' -s '${ | ||
scanRunDetail.scanner.scanKeyword | ||
}' ${headerArgs.trim()} -v -L 4 > ${getScannerLogLocation( | ||
scanRunDetail._id.toString(), | ||
)}`; | ||
this.logger.log(`Running command: ${cmd}`); | ||
|
||
const { stdout, stderr } = await exec('bash', ['-c', cmd]); | ||
this.logger.log(`Stdout: ${stdout}`); | ||
this.logger.log(`Stderr: ${stderr}`); | ||
|
||
// const { stdout, stderr } = await exec('whoami'); | ||
// this.logger.log(`Stdout: ${stdout}`); | ||
// this.logger.log(`Stderr: ${stderr}`); | ||
} | ||
} |
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
Oops, something went wrong.