- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.117.11.13
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/puertode/public_html/fotografico/apps/logreader/js/Providers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/puertode/public_html/fotografico/apps/logreader/js/Providers/LogFile.js
import {LogProvider} from './LogProvider.js'

export class LogFile extends LogProvider {
	constructor (content, limit) {
		super(limit);

		// newlines that aren't proceeded by a '}' are either invalid or cary no meaning
		content = content.replace(/([^}])\s*([\n\r]+)/g, "$1");

		this.content = content;
		this.lines = this.content.split('\n');
	}

	async loadEntries (offset, count = 50) {
		const start = this.lines.length - offset;
		const end = Math.max(start - count - 2, 0);
		const entries = this.lines.slice(end, start).reverse()
			.map(this.tryParseJSON)
			.map(entry => {
				if (!entry.id) {
					entry.id = Math.random() * 10000;
				}
				return entry;
			});
		return {data: entries};
	}

	tryParseJSON (json) {
		try {
			return JSON.parse(json);
		} catch (e) {
			// fix unescaped message json
			const startPos = json.indexOf('"message":"') + ('"message":"').length;
			const endPos = json.lastIndexOf('","level":');
			const start = json.substr(0, startPos);
			const end = json.substr(endPos);
			const message = json.substr(startPos, endPos - startPos);

			const escapedMessage = message.replace(/([^\\]|^)["]/g, '$1\\"');
			json = start + escapedMessage + end;

			try {
				return JSON.parse(json);
			} catch (e) {
				console.log('Error while parsing log message:');
				console.log(json);
				console.error(e);
			}
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit