mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-17 23:25:27 +00:00
* introduce typescript files generation using ast + tmpl * feat valid ts with scraping * feat remove old logic + tsdocs for all modules * fix ikev and related bugs * typescript docs for js modules * lint,build + ldap realm fix * go mod tidy * fix named imports ast parsing * fix ast code generation errors * complete support for ts files generation * support go global/const in ts docs * updated template * feat: typescript using go code generation * nuke jsdoc generator * update generated ts dir structure * fix multifile ts gen issue * fix panic in ts code gen * fix test * update docs of js libs * feat: add doc+example for every js class,function,method * fix missing quotes in ikev example --------- Co-authored-by: Sandeep Singh <sandeep@projectdiscovery.io>
142 lines
3.0 KiB
TypeScript
Executable File
142 lines
3.0 KiB
TypeScript
Executable File
|
|
|
|
/**
|
|
* Buffer is a bytes/Uint8Array type in javascript
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const bytes = new bytes.Buffer();
|
|
* ```
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* // optionally it can accept existing byte/Uint8Array as input
|
|
* const bytes = new bytes.Buffer([1, 2, 3]);
|
|
* ```
|
|
*/
|
|
export class Buffer {
|
|
|
|
|
|
// Constructor of Buffer
|
|
constructor() {}
|
|
/**
|
|
* Write appends the given data to the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.Write([1, 2, 3]);
|
|
* ```
|
|
*/
|
|
public Write(data: Uint8Array): Buffer {
|
|
return this;
|
|
}
|
|
|
|
|
|
/**
|
|
* WriteString appends the given string data to the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* ```
|
|
*/
|
|
public WriteString(data: string): Buffer {
|
|
return this;
|
|
}
|
|
|
|
|
|
/**
|
|
* Bytes returns the byte representation of the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* log(buffer.Bytes());
|
|
* ```
|
|
*/
|
|
public Bytes(): Uint8Array {
|
|
return new Uint8Array(8);
|
|
}
|
|
|
|
|
|
/**
|
|
* String returns the string representation of the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* log(buffer.String());
|
|
* ```
|
|
*/
|
|
public String(): string {
|
|
return "";
|
|
}
|
|
|
|
|
|
/**
|
|
* Len returns the length of the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* log(buffer.Len());
|
|
* ```
|
|
*/
|
|
public Len(): number {
|
|
return 0;
|
|
}
|
|
|
|
|
|
/**
|
|
* Hex returns the hex representation of the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* log(buffer.Hex());
|
|
* ```
|
|
*/
|
|
public Hex(): string {
|
|
return "";
|
|
}
|
|
|
|
|
|
/**
|
|
* Hexdump returns the hexdump representation of the buffer.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.WriteString('hello');
|
|
* log(buffer.Hexdump());
|
|
* ```
|
|
*/
|
|
public Hexdump(): string {
|
|
return "";
|
|
}
|
|
|
|
|
|
/**
|
|
* Pack uses structs.Pack and packs given data and appends it to the buffer.
|
|
* it packs the data according to the given format.
|
|
* @example
|
|
* ```javascript
|
|
* const bytes = require('nuclei/bytes');
|
|
* const buffer = new bytes.Buffer();
|
|
* buffer.Pack('I', 123);
|
|
* ```
|
|
*/
|
|
public Pack(formatStr: string, msg: any): void {
|
|
return;
|
|
}
|
|
|
|
|
|
}
|
|
|