Skip to content

Commit

Permalink
check with dryrun that scanners available
Browse files Browse the repository at this point in the history
  • Loading branch information
RomainMaillot committed Oct 23, 2022
1 parent 89868bc commit 0fc85ed
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 19 deletions.
27 changes: 24 additions & 3 deletions web/client/src/components/Scanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,34 @@ export default class Scanner extends Vue {
collapseId = "scanner-collapse" + this.scanId;
mounted(): void {
this.testScan();
};
private async testScan(): Promise<void> {
try {
const res = await axios.post(
`${config.apiUrl}/v2/scanners/${this.scanId}/dryrun`,
{
number: this.$store.state.number,
}
);
if (!res.data.success && res.data.error) {
throw res.data.error;
}
} catch (error) {
this.error = error;
}
}
private async runScan(): Promise<void> {
this.loading = true;
try {
const res = await axios.get(
`${config.apiUrl}/numbers/${this.$store.state.number}/scan/${this.scanId}`,
const res = await axios.post(
`${config.apiUrl}/v2/scanners/${this.scanId}/run`,
{
validateStatus: () => true,
number: this.$store.state.number,
}
);
Expand Down
2 changes: 1 addition & 1 deletion web/client/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default {
appName: "PhoneInfoga",
appDescription:
"Advanced information gathering & OSINT tool for phone numbers",
apiUrl: "/api",
apiUrl: "/api", // /api
};
28 changes: 25 additions & 3 deletions web/client/src/views/Number.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@

<b-container v-if="isLookup" class="border p-4">
<h3 class="text-center">Scanners</h3>
<Scanner name="GoogleSearch" scanId="googlesearch" />
<Scanner name="Numverify Scan" scanId="numverify" />
<Scanner name="OVH Telecom scan" scanId="ovh" />
<Scanner
v-for="(scanner, index) in scanners"
:key="index"
:name="scanner.name.charAt(0).toUpperCase() + scanner.name.slice(1)"
:scanId="scanner.name"
/>
</b-container>
</div>
</template>
Expand All @@ -27,9 +30,15 @@ import Scanner from "../components/Scanner.vue";
import axios, { AxiosResponse } from "axios";
import config from "@/config";
interface ScannerObject {
name: string;
description: string;
}
interface Data {
loading: boolean;
isLookup: boolean;
scanners: Array<ScannerObject>;
localData: {
raw_local: string;
local: string;
Expand All @@ -56,6 +65,7 @@ export default Vue.extend({
return {
loading: false,
isLookup: false,
scanners: [],
localData: {
raw_local: "",
local: "",
Expand All @@ -67,9 +77,21 @@ export default Vue.extend({
};
},
mounted() {
this.getScanners();
this.runScans();
},
methods: {
async getScanners() {
try {
const res = await axios.get(`${config.apiUrl}/v2/scanners`);
this.scanners = res.data.scanners.filter(
(scanner: ScannerObject) => scanner.name !== "local"
);
} catch (error) {
this.$store.commit("pushError", { message: error });
}
},
async runScans(): Promise<void> {
if (!isValid(this.$route.params.number)) {
this.$store.commit("pushError", { message: "Number is not valid." });
Expand Down
38 changes: 26 additions & 12 deletions web/client/src/views/Scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@

<b-container v-if="isLookup" class="border p-4">
<h3 class="text-center">Scanners</h3>
<Scanner name="GoogleSearch" scanId="googlesearch" />
<Scanner name="Numverify Scan" scanId="numverify" />
<Scanner name="OVH Telecom scan" scanId="ovh" />
<Scanner
v-for="(scanner, index) in scanners"
:key="index"
:name="scanner.name.charAt(0).toUpperCase() + scanner.name.slice(1)"
:scanId="scanner.name"
/>
</b-container>

<!-- <LocalScan :scan="scanEvent" />
<NumverifyScan :scan="scanEvent" />
<GoogleSearch :scan="scanEvent" />
<OVHScan :scan="scanEvent" /> -->
</div>
</template>

Expand All @@ -75,19 +73,21 @@ import { mapMutations, mapState } from "vuex";
import { formatNumber, isValid } from "../utils";
import VuePhoneNumberInput from "vue-phone-number-input";
import Scanner from "../components/Scanner.vue";
// import LocalScan from "../components/LocalScan.vue";
// import NumverifyScan from "../components/NumverifyScan.vue";
// import GoogleSearch from "../components/GoogleSearch.vue";
// import OVHScan from "../components/OVHScan.vue";
import axios, { AxiosResponse } from "axios";
import config from "@/config";
interface ScannerObject {
name: string;
description: string;
}
interface Data {
loading: boolean;
isLookup: boolean;
inputNumber: string;
inputNumberVal: string;
scanEvent: Vue;
scanners: Array<ScannerObject>;
localData: {
raw_local: string;
local: string;
Expand Down Expand Up @@ -117,6 +117,7 @@ export default Vue.extend({
inputNumber: "",
inputNumberVal: "",
scanEvent: new Vue(),
scanners: [],
localData: {
raw_local: "",
local: "",
Expand Down Expand Up @@ -156,6 +157,8 @@ export default Vue.extend({
this.$store.commit("pushError", { message: error });
}
this.getScanners();
this.isLookup = true;
this.loading = false;
// this.scanEvent.$emit("scan");
Expand All @@ -171,6 +174,17 @@ export default Vue.extend({
updateInputNumber(val: any) {
this.inputNumber = val.e164;
},
async getScanners() {
try {
const res = await axios.get(`${config.apiUrl}/v2/scanners`);
this.scanners = res.data.scanners.filter(
(scanner: ScannerObject) => scanner.name !== "local"
);
} catch (error) {
this.$store.commit("pushError", { message: error });
}
},
},
});
</script>
Expand Down

0 comments on commit 0fc85ed

Please sign in to comment.