Compare commits

..

No commits in common. "ee96659aa0abfb993aea2d433744ad8b7b13a76b" and "f26adda1a805df0ac46b876e35cb59d9ed193d06" have entirely different histories.

5 changed files with 12 additions and 38 deletions

View File

@ -17,12 +17,10 @@ export default class ExtendedRequest {
public requestHeaders: Request["requestHeaders"]; public requestHeaders: Request["requestHeaders"];
public origin: string; public origin: string;
public initialized = false; public initialized = false;
public stolenData: StolenDataEntry[];
async init() { async init() {
await this.cacheOrigin(); await this.cacheOrigin();
this.initialized = true; this.initialized = true;
this.stolenData = this.getAllStolenData();
} }
async cacheOrigin(): Promise<void> { async cacheOrigin(): Promise<void> {
@ -69,13 +67,13 @@ export default class ExtendedRequest {
const path = url.pathname; const path = url.pathname;
return ( return (
this.getReferer().includes(host) || this.getReferer().includes(host) ||
this.stolenData.filter( this.getAllStolenData().filter(
(entry) => entry.value.includes(host) || entry.value.includes(path) (entry) => entry.value.includes(host) || entry.value.includes(path)
).length > 0 ).length > 0
); );
} }
private getAllStolenData(): StolenDataEntry[] { getAllStolenData(): StolenDataEntry[] {
return [ return [
...this.getPathParams(), ...this.getPathParams(),
...this.getCookieData(), ...this.getCookieData(),

View File

@ -18,7 +18,6 @@ export class StolenDataEntry {
public isIAB = false; public isIAB = false;
public iab: TCModel | null = null; public iab: TCModel | null = null;
public id: number; public id: number;
public markedKeys: string[] = [];
constructor( constructor(
public request: ExtendedRequest, public request: ExtendedRequest,
@ -75,19 +74,8 @@ export class StolenDataEntry {
} }
} }
getParsedValue(key_path: string): string | Record<string, unknown> { getParsedValue(): string | Record<string, unknown> {
let object = StolenDataEntry.parseValue(this.value); return StolenDataEntry.parseValue(this.value);
console.log("key_path", key_path);
for (const key of key_path.split(".")) {
if (key === "") continue;
console.log(key, object[key]);
object = StolenDataEntry.parseValue(object[key]);
}
return object;
}
addMarkedValue(key: string) {
this.markedKeys.push(key);
} }
} }
@ -125,14 +113,8 @@ export class MergedStolenDataEntry {
return Array.from(new Set(this.entries.map((e) => e.value))); return Array.from(new Set(this.entries.map((e) => e.value)));
} }
getParsedValues(key_path: string) { getParsedValues() {
return Array.from( return Array.from(new Set(this.entries.map((e) => e.getParsedValue())));
new Set(this.entries.map((e) => e.getParsedValue(key_path)))
);
}
addMarkedValue(key: string) {
this.entries.forEach((entry) => entry.addMarkedValue(key));
} }
} }
@ -160,7 +142,7 @@ export class RequestCluster extends EventEmitter {
cookiesOnly: boolean; cookiesOnly: boolean;
}): MergedStolenDataEntry[] { }): MergedStolenDataEntry[] {
return this.requests return this.requests
.map((request) => request.stolenData) .map((request) => request.getAllStolenData())
.reduce((a, b) => a.concat(b), []) .reduce((a, b) => a.concat(b), [])
.filter((entry) => { .filter((entry) => {
return entry.value.length >= filter.minValueLength; return entry.value.length >= filter.minValueLength;

View File

@ -17,7 +17,7 @@ const Sidebar = () => {
const [origin, setOrigin] = useState<string | null>(null); const [origin, setOrigin] = useState<string | null>(null);
const [minValueLength, setMinValueLength] = useState<number | null>(7); const [minValueLength, setMinValueLength] = useState<number | null>(7);
const [cookiesOnly, setCookiesOnly] = useState<boolean>(false); const [cookiesOnly, setCookiesOnly] = useState<boolean>(false);
const [counter, setCounter] = useEmitter(memory); const [counter] = useEmitter(memory);
useEffect(() => { useEffect(() => {
const listener = async (data) => { const listener = async (data) => {
@ -55,7 +55,6 @@ const Sidebar = () => {
<StolenData <StolenData
origin={origin} origin={origin}
refreshToken={counter} refreshToken={counter}
refresh={() => setCounter((c) => c + 1)}
minValueLength={minValueLength} minValueLength={minValueLength}
cookiesOnly={cookiesOnly} cookiesOnly={cookiesOnly}
/> />

View File

@ -45,7 +45,7 @@ function StolenDataValue({
return <StolenDataValueTable object={value} prefixKey={prefixKey} />; return <StolenDataValueTable object={value} prefixKey={prefixKey} />;
} }
export default function StolenDataCluster({ export default function StolenDataRow({
origin, origin,
shorthost, shorthost,
minValueLength, minValueLength,

View File

@ -1,19 +1,17 @@
import React from "react"; import React from "react";
import memory from "./memory"; import memory from "./memory";
import { RequestCluster } from "./request-cluster"; import { RequestCluster } from "./request-cluster";
import StolenDataCluster from "./stolen-data-cluster"; import StolenDataRow from "./stolen-data-row";
import { getshorthost } from "./util"; import { getshorthost } from "./util";
export function StolenData({ export function StolenData({
origin, origin,
minValueLength, minValueLength,
refreshToken, refreshToken,
refresh,
cookiesOnly, cookiesOnly,
}: { }: {
origin: string; origin: string;
refreshToken: number; refreshToken: number;
refresh: () => void;
minValueLength: number; minValueLength: number;
cookiesOnly: boolean; cookiesOnly: boolean;
}) { }) {
@ -42,10 +40,7 @@ export function StolenData({
</button> </button>
<button <button
style={{ marginLeft: "1rem" }} style={{ marginLeft: "1rem" }}
onClick={() => { onClick={() => memory.removeRequestsFor(origin)}
memory.removeRequestsFor(origin);
refresh();
}}
> >
Wyczyść pamięć Wyczyść pamięć
</button> </button>
@ -54,7 +49,7 @@ export function StolenData({
.filter((cluster) => !cookiesOnly || cluster.hasCookies()) .filter((cluster) => !cookiesOnly || cluster.hasCookies())
.map((cluster) => { .map((cluster) => {
return ( return (
<StolenDataCluster <StolenDataRow
origin={origin} origin={origin}
shorthost={cluster.id} shorthost={cluster.id}
key={cluster.id + origin} key={cluster.id + origin}