How to forbid user from executing malicious shell and Python script?

I am designing a online programming website similar to https://repl.it. Users can execute shell and python scripts on the browsers.

If users execute malicious commands including but not limited to “reboot” etc, then our system are damaged.

I understand the easiest way is to leverage Linux user control system. But I do not think this is the most secure way. What are more secure options for building such sites?

Suppose I have 10,000 users and they will perform computing-intensive tasks. I am using AWS.

Looking for popunder tab script

Does anyone have a working popunder tab script? basically it should do this: When a user visits your site and clicks anywhere on the page it should open a new tab in the background that goes to different site while the current tab is still on focused. I also need a cookie session so it only appears once a day. Anyone have this script? cause all browsers block popup windows but they don't block popunder tabs.

What is the best pop-under script? Preferably unblockable.

Hi all….what is the best pop-under script. Preferably one that is unblockable by the majority of pop up blockers, particularly googles toolbar. I am currently using a javascript command (w=window.open) to create the pop under but i notice it is blocked often by pop up blockers and i would like to see our popunder advertiser get a little more for their money. Please help. Thanks in advance, DP rocks.

18.04: How can udev rule RUN script access network

I have an udev rule that downloads a file when a USB device is plugged in:

ACTION=="add", ATTRS{idVendor}=="cafe", MODE="0660", GROUP="root", SUBSYSTEM=="usbmisc", RUN+="/home/me/udev-net.sh" 

The script does a simple wget:

#!/bin/sh wget -o /tmp/wget.log -O /tmp/index.html http://www.google.com 

This works well on Ubuntu 16.04, but on 18.04 wget fails to resolve www.google.com – after triggering the script /tmp/wget.log contains:

--2019-08-19 14:49:43--  http://www.google.com/ Resolving www.google.com (www.google.com)... failed: Name or service not known. wget: unable to resolve host address 'www.google.com' 

If I add an entry ‘172.217.23.164 mygoogle’ to /etc/hosts, the resolve succeeds, but then wget blocks in socket connect(), and after some time the wget process is killed.

Is there some way of allowing this in Ubuntu 18.04, so that behavior is the same as on 16.04?

Change DNS server and restart connection via script

In order for my VPN to work without DNS leaks, I have to manually add two DNS servers and replace them with my regular DNS server (my local Pi-Hole) when not using the VPN. I’m on KDEneon and have no problems doing this using the GUI as described here: https://www.lifewire.com/how-to-configure-networking-in-kde-plasma-4683939

This allows me to:

  1. Change the DNS server
  2. Disconnect and reconnect the interface to apply the new settings

Now I was wondering if there is a way of writing a script to avoid having to change these settings manually.

In order to use the DNS servers for my VPN, I can use the sed command to change the settings for my connection in /etc/NetworkManager/system-connections without any issues.

However, the Networkmanager seems to ignore the new settings in the file even after restarting the service using

‘sudo systemctl restart NetworkManager.service’

Any suggestions?

getEnumerator causing collection has not been initialized error inside of async call inside of a loop in a script editor web part

This is an issue I’ve been struggling with – What I am doing is using a script editor web part and when a user clicks the button, I check to see if a list exists inside of a loop (in this example, it could be called Data1 – Data10) and if so, then I want to pull all of the items from that list based on the query, which is based on filters with other controls (Ignore the datepickers/filters – I know the query works)

The problem I’m hitting is that I’m running these async calls inside of my ‘does the list exist’ loop and getting to the getEnumerator line where I receive the error :

Error: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

I had previously posted a simplified version of this question and didn’t receive a response so was hoping if I posted the entirety of my solution that it may give me an answer.

Thanks

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js "></script>     <link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">     <script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>     <script type="text/javascript" language="javascript">      $  (function() {         $  ( "#datepickerStart" ).datepicker();         $  ( "#datepickerEnd" ).datepicker();     });      var valStopped = 10;     var allItems;     function getListData()      {         var _clientContext;         var _web;         _clientContext = new SP.ClientContext.get_current();         _web = _clientContext.get_web();         var lists = _web.get_lists();         _clientContext.load(lists,'Include(Title)');         //Get all lists...         var listTitle = "";         var arrayOfMatchedLists = [];         var responses = {exists:false,record:0};         var arrayOfPromises = [];          for (var j = 1; j < valStopped; j++) //loop through all potential lists and see if they exist         {             listTitle = "Data" + j;             arrayOfPromises.push(get_isListExists(listTitle,j,function(listExists,counter){             if (listExists){                 responses = {exists:listExists,record:counter};                 arrayOfMatchedLists.push(responses);             }             },function(sender,args){}));         }         $  .when.apply($  , arrayOfPromises).done(function() {         var largest = 0;         for (var item in arrayOfMatchedLists)          {         //Get the largest list index             if (arrayOfMatchedLists[item].record > largest)             {                 largest = arrayOfMatchedLists[item].record;             }         }         populateList(largest);             });      }       function populateList(counter)      {      for (var i = 1; i <= counter; i++)         {              var _clientContext;             var _web;             _clientContext = new SP.ClientContext.get_current();             _web = _clientContext.get_web();             var listTitle = "Data" + i; //+ i;             var list = _web.get_lists().getByTitle(listTitle);             var myquery = new SP.CamlQuery();             if ($  ("Data6").val() !== "All") //get Data6 as a filter if it's not all, else don't use Data6 as a filter.             {                 myquery.set_viewXml('<View><ViewFields><FieldRef Name=\'Data1\'/><FieldRef Name=\'Data2\'/><FieldRef Name=\'Data3\'/><FieldRef Name=\'Data4\'/><FieldRef Name=\'Data5\'/><FieldRef Name=\'Data6\'/><FieldRef Name=\'Data7\'/><FieldRef Name=\'Data8\'/><FieldRef Name=\'Data9\'/><FieldRef Name=\'Data10\'/></ViewFields></View>');             }             //else set query as all facilities             allItems = list.getItems(myquery);              _clientContext.load(allItems, 'Include(Data1,Data2,Data3,Data4,Data5,Data6,Data7,Data8,Data9,Data10)');             _clientContext.executeQuery(Function.createDelegate(this, this.onQuerySucceeded()), Function.createDelegate(this, this.onQueryFailed));         }                }      function onQuerySucceeded()      {         var Data1 = null;         var Data2 = null;         var Data3 = null;         var Data4 = null;         var Data5 = null;         var Data6 = null;         var Data7 = null;         var Data8 = null;         var Data9 = null;         var Data10 = null;         var txtHTML = "";          console.log("before enum");         var listEnumerator = allItems.getEnumerator();         console.log("get enumerator");             while (listEnumerator.moveNext()) {                     console.log("before got current");                     var currentItem = listEnumerator.get_current();                     console.log("got current");                     Data1 = currentItem.get_item('Data1');                     Data2 = currentItem.get_item('Data2');                     Data3 = currentItem.get_item('Data3');                     Data4 = currentItem.get_item('Data4');                     Data5 = currentItem.get_item('Data5');                     Data6 = currentItem.get_item('Data6');                     Data7 = currentItem.get_item('Data7');                     Data8 = currentItem.get_item('Data8');                     Data9 = currentItem.get_item('Data9');                     Data10 = currentItem.get_item('Data10');                     var row = document.createElement("tr");                      txtHTML = txtHTML + "<tr>";                     txtHTML = txtHTML + "<td>";                     if (Data1 != null) {                         txtHTML = txtHTML + "<p>" + Data1 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                      txtHTML = txtHTML + "<td>";                     if (Data2 != null) {                         txtHTML = txtHTML + "<p>" + Data2 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                      txtHTML = txtHTML + "<td>";                     if (Data3 != null) {                         txtHTML = txtHTML + "<p>" + Data3 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                      txtHTML = txtHTML + "<td>";                     if (Data4 != null) {                         txtHTML = txtHTML + "<p>" + Data4 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                                                      txtHTML = txtHTML + "<td>";                     if (Data5 != null) {                         txtHTML = txtHTML + "<p>" + Data5 + "</p>";                     }                     txtHTML = txtHTML + "<td>";                     if (Data6 != null) {                         txtHTML = txtHTML + "<p>" + Data6 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                         txtHTML = txtHTML + "<td>";                     if (Data7 != null) {                         txtHTML = txtHTML + "<p>" + Data7 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                         txtHTML = txtHTML + "<td>";                     if (Data8 != null) {                         txtHTML = txtHTML + "<p>" + Data8 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                         txtHTML = txtHTML + "<td>";                     if (Data9 != null) {                         txtHTML = txtHTML + "<p>" + Data9 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                         txtHTML = txtHTML + "<td>";                     if (Data10 != null) {                         txtHTML = txtHTML + "<p>" + Data10 + "</p>";                     }                     txtHTML = txtHTML + "</td>";                         txtHTML = txtHTML + "</tr>";             }             console.log("ran");         $  ("#tblCustomListData").append(txtHTML);     }      function onQueryFailed(sender, args)      {         alert("failed Message" + args.get_message());     }      function get_isListExists(listTitle, counter, OnSuccess, OnError){          var ctx = SP.ClientContext.get_current();         var web = ctx.get_web();         var lists = web.get_lists();         ctx.load(lists);          var outValue = $  .Deferred();         ctx.executeQueryAsync(           function() {           if (counter <= valStopped){             var listExists = false;               var le = lists.getEnumerator();             while (le.moveNext()) {                     var list = le.get_current();                     if(list.get_title() == listTitle) {                         listExists = true;                         break;                     }                 }                 }            outValue.resolve();           OnSuccess(listExists,counter);           OnError();             });         return outValue.promise();     }  </script>        <p> Data6: <select id="Data6">       <option value="Op1">Op1</option>       <option value="Op2">Op2</option>       <option value="Op3">Op3</option>       <option value="Op4">Op4</option>       <option value="Op5">Op5</option>       <option value="Op6">Op6</option>     </select> </p>     <p>Start Date: <input type="text" id="datepickerStart">     End Date: <input type="text" id="datepickerEnd"></p>     <center><button ID="retrieveList" onclick="ExecuteOrDelayUntilScriptLoaded(getListData(), 'sp.js');return false">Retrieve List</button></center></br>     <table id="tblCustomListData" border="1">         <thead>             <tr>                 <th>Data1                 </th>                 <th>Data2                 </th>                 <th>Data3                 </th>                 <th>Data4                 </th>                 <th>Data5                 </th>                 <th>Data6                 </th>                 <th>Data7                 </th>                 <th>Data8                 </th>                 <th>Data9                 </th>                 <th>Data10                 </th>                                    </tr>         </thead>     </table> 

Write $(date) Into File Using Cron and Bash Shell Script

Ubuntu 18.04 running as guest on MacOS 10.14.3. Hypervisor: VMWare Fusion 10

Objective: Every minute, append the date/time into a file

Status: Script runs every minute, inserting a blank new line into the text file. The date is not included. That is the problem

When the script is run from the command line, using the same account as the account on the crontab, the date is added to the file, no problem.

Apparent Problem: Echoing date to file works from command line, but same command from cron does not produce date

This is the script that runs every minute in cron.

#!/bin/bash #append_date_to_file.sh target_file='/home/dan/timestamps' echo $  (date)  >>  $  target_file 

This is the cron entry

crontab -e  PATH=/bin/bash: *       *       *       *       *       /home/dan/append_date_to_file.sh 

RESULTS When running three times from command line, then viewing the target file:

$   cat /home/dan/timestamps Sat Aug 17 18:31:12 CDT 2019 Sat Aug 17 18:31:33 CDT 2019 Sat Aug 17 18:31:34 CDT 2019 

Then waiting three minutes, to let it run three times in cron, then viewing the target file: (same as above, except three new blank lines after the dates.)

Problems Considered .. file permissions. To address this, here is the file as it is listed with permissions and owner:group:

-rwxrwxrwx 1 dan dan  157 Aug 17 18:43 timestamps* 

.. Script not running in cron. Resolved: script is proven to run by the fact that modified time on the file changes at the start of every minute and the file gets a new blank line at the same time.

I cannot think of an explanation for the date not being added to the file when the script is run by cron instead of the command line.

Any ideas would be appreciated.

Thank you.