UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

550 lines 18.2 kB
import * as Core from 'cloudflare/core'; import { APIResource } from 'cloudflare/resource'; import { type Response } from 'cloudflare/_shims/index'; import * as ScansAPI from 'cloudflare/resources/url-scanner/scans'; export declare class Scans extends APIResource { /** * Submit a URL to scan. You can also set some options, like the visibility level * and custom headers. Accounts are limited to 1 new scan every 10 seconds and 8000 * per month. If you need more, please reach out. */ create(accountId: string, body: ScanCreateParams, options?: Core.RequestOptions): Core.APIPromise<ScanCreateResponse>; /** * Get URL scan by uuid */ get(accountId: string, scanId: string, options?: Core.RequestOptions): Core.APIPromise<ScanGetResponse>; /** * Get a URL scan's HAR file. See HAR spec at * http://www.softwareishard.com/blog/har-12-spec/. */ har(accountId: string, scanId: string, options?: Core.RequestOptions): Core.APIPromise<ScanHarResponse>; /** * Get scan's screenshot by resolution (desktop/mobile/tablet). */ screenshot(accountId: string, scanId: string, query?: ScanScreenshotParams, options?: Core.RequestOptions): Core.APIPromise<Response>; screenshot(accountId: string, scanId: string, options?: Core.RequestOptions): Core.APIPromise<Response>; } export interface ScanCreateResponse { /** * Time when url was submitted for scanning. */ time: string; /** * Canonical form of submitted URL. Use this if you want to later search by URL. */ url: string; /** * Scan ID. */ uuid: string; /** * Submitted visibility status. */ visibility: string; } export interface ScanGetResponse { scan: ScanGetResponse.Scan; } export declare namespace ScanGetResponse { interface Scan { certificates: Array<Scan.Certificate>; geo: Scan.Geo; meta: Scan.Meta; page: Scan.Page; performance: Array<Scan.Performance>; task: Scan.Task; verdicts: Scan.Verdicts; /** * Dictionary of Autonomous System Numbers where ASN's are the keys */ asns?: Scan.ASNs; domains?: Scan.Domains; ips?: Scan.IPs; links?: Scan.Links; } namespace Scan { interface Certificate { issuer: string; subjectName: string; validFrom: number; validTo: number; } interface Geo { /** * GeoIP continent location */ continents: Array<string>; /** * GeoIP country location */ locations: Array<string>; } interface Meta { processors: Meta.Processors; } namespace Meta { interface Processors { categories: Processors.Categories; phishing: Array<string>; rank: Processors.Rank; tech: Array<Processors.Tech>; } namespace Processors { interface Categories { content: Array<Categories.Content>; risks: Array<Categories.Risk>; } namespace Categories { interface Content { id: number; name: string; super_category_id?: number; } interface Risk { id: number; name: string; super_category_id: number; } } interface Rank { bucket: string; name: string; /** * Rank in the Global Radar Rank, if set. See more at * https://blog.cloudflare.com/radar-domain-rankings/ */ rank?: number; } interface Tech { categories: Array<Tech.Category>; confidence: number; evidence: Tech.Evidence; icon: string; name: string; slug: string; website: string; description?: string; } namespace Tech { interface Category { id: number; groups: Array<number>; name: string; priority: number; slug: string; } interface Evidence { impliedBy: Array<string>; patterns: Array<Evidence.Pattern>; } namespace Evidence { interface Pattern { confidence: number; excludes: Array<string>; implies: Array<string>; match: string; /** * Header or Cookie name when set */ name: string; regex: string; type: string; value: string; version: string; } } } } } interface Page { asn: string; asnLocationAlpha2: string; asnname: string; console: Array<Page.Console>; cookies: Array<Page.Cooky>; country: string; countryLocationAlpha2: string; domain: string; headers: Array<Page.Header>; ip: string; js: Page.Js; securityViolations: Array<Page.SecurityViolation>; status: number; subdivision1Name: string; subdivision2name: string; url: string; } namespace Page { interface Console { category: string; text: string; type: string; url?: string; } interface Cooky { domain: string; expires: number; httpOnly: boolean; name: string; path: string; sameParty: boolean; secure: boolean; session: boolean; size: number; sourcePort: number; sourceScheme: string; value: string; priority?: string; } interface Header { name: string; value: string; } interface Js { variables: Array<Js.Variable>; } namespace Js { interface Variable { name: string; type: string; } } interface SecurityViolation { category: string; text: string; url: string; } } interface Performance { connectEnd: number; connectStart: number; decodedBodySize: number; domainLookupEnd: number; domainLookupStart: number; domComplete: number; domContentLoadedEventEnd: number; domContentLoadedEventStart: number; domInteractive: number; duration: number; encodedBodySize: number; entryType: string; fetchStart: number; initiatorType: string; loadEventEnd: number; loadEventStart: number; name: string; nextHopProtocol: string; redirectCount: number; redirectEnd: number; redirectStart: number; requestStart: number; responseEnd: number; responseStart: number; secureConnectionStart: number; startTime: number; transferSize: number; type: string; unloadEventEnd: number; unloadEventStart: number; workerStart: number; } interface Task { /** * Submitter location */ clientLocation: string; clientType: 'Site' | 'Automatic' | 'Api'; /** * URL of the primary request, after all HTTP redirects */ effectiveUrl: string; errors: Array<Task.Error>; scannedFrom: Task.ScannedFrom; status: 'Queued' | 'InProgress' | 'InPostProcessing' | 'Finished'; success: boolean; time: string; timeEnd: string; /** * Submitted URL */ url: string; /** * Scan ID */ uuid: string; visibility: 'Public' | 'Unlisted'; } namespace Task { interface Error { message: string; } interface ScannedFrom { /** * IATA code of Cloudflare datacenter */ colo: string; } } interface Verdicts { overall: Verdicts.Overall; } namespace Verdicts { interface Overall { categories: Array<Overall.Category>; /** * At least one of our subsystems marked the site as potentially malicious at the * time of the scan. */ malicious: boolean; phishing: Array<string>; } namespace Overall { interface Category { id: number; name: string; super_category_id: number; } } } /** * Dictionary of Autonomous System Numbers where ASN's are the keys */ interface ASNs { /** * ASN's contacted */ asn?: ASNs.ASN; } namespace ASNs { /** * ASN's contacted */ interface ASN { asn: string; description: string; location_alpha2: string; name: string; org_name: string; } } interface Domains { 'example.com'?: Domains.ExampleCom; } namespace Domains { interface ExampleCom { categories: ExampleCom.Categories; dns: Array<ExampleCom.DNS>; name: string; rank: ExampleCom.Rank; type: string; } namespace ExampleCom { interface Categories { inherited: Categories.Inherited; content?: Array<Categories.Content>; risks?: Array<Categories.Risk>; } namespace Categories { interface Inherited { content?: Array<Inherited.Content>; from?: string; risks?: Array<Inherited.Risk>; } namespace Inherited { interface Content { id: number; name: string; super_category_id?: number; } interface Risk { id: number; name: string; super_category_id?: number; } } interface Content { id: number; name: string; super_category_id?: number; } interface Risk { id: number; name: string; super_category_id?: number; } } interface DNS { address: string; dnssec_valid: boolean; name: string; type: string; } interface Rank { bucket: string; name: string; /** * Rank in the Global Radar Rank, if set. See more at * https://blog.cloudflare.com/radar-domain-rankings/ */ rank?: number; } } } interface IPs { ip?: IPs.IP; } namespace IPs { interface IP { asn: string; asnDescription: string; asnLocationAlpha2: string; asnName: string; asnOrgName: string; continent: string; geonameId: string; ip: string; ipVersion: string; latitude: string; locationAlpha2: string; locationName: string; longitude: string; subdivision1Name: string; subdivision2Name: string; } } interface Links { link?: Links.Link; } namespace Links { interface Link { /** * Outgoing link detected in the DOM */ href: string; text: string; } } } } export interface ScanHarResponse { har: ScanHarResponse.Har; } export declare namespace ScanHarResponse { interface Har { log: Har.Log; } namespace Har { interface Log { creator: Log.Creator; entries: Array<Log.Entry>; pages: Array<Log.Page>; version: string; } namespace Log { interface Creator { comment: string; name: string; version: string; } interface Entry { _initialPriority: string; _initiator_type: string; _priority: string; _requestId: string; _requestTime: number; _resourceType: string; cache: unknown; connection: string; pageref: string; request: Entry.Request; response: Entry.Response; serverIPAddress: string; startedDateTime: string; time: number; } namespace Entry { interface Request { bodySize: number; headers: Array<Request.Header>; headersSize: number; httpVersion: string; method: string; url: string; } namespace Request { interface Header { name: string; value: string; } } interface Response { _transferSize: number; bodySize: number; content: Response.Content; headers: Array<Response.Header>; headersSize: number; httpVersion: string; redirectURL: string; status: number; statusText: string; } namespace Response { interface Content { mimeType: string; size: number; compression?: number; } interface Header { name: string; value: string; } } } interface Page { id: string; pageTimings: Page.PageTimings; startedDateTime: string; title: string; } namespace Page { interface PageTimings { onContentLoad: number; onLoad: number; } } } } } export interface ScanCreateParams { url: string; /** * Set custom headers */ customHeaders?: Record<string, string>; /** * Take multiple screenshots targeting different device types */ screenshotsResolutions?: Array<'desktop' | 'mobile' | 'tablet'>; /** * The option `Public` means it will be included in listings like recent scans and * search results. `Unlisted` means it will not be included in the aforementioned * listings, users will need to have the scan's ID to access it. A a scan will be * automatically marked as unlisted if it fails, if it contains potential PII or * other sensitive material. */ visibility?: 'Public' | 'Unlisted'; } export interface ScanScreenshotParams { /** * Target device type */ resolution?: 'desktop' | 'mobile' | 'tablet'; } export declare namespace Scans { export import ScanCreateResponse = ScansAPI.ScanCreateResponse; export import ScanGetResponse = ScansAPI.ScanGetResponse; export import ScanHarResponse = ScansAPI.ScanHarResponse; export import ScanCreateParams = ScansAPI.ScanCreateParams; export import ScanScreenshotParams = ScansAPI.ScanScreenshotParams; } //# sourceMappingURL=scans.d.ts.map