Search Results

Search found 22267 results on 891 pages for 'script'.

Page 22/891 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • How to run bash script from windows using plink on linux

    - by user128877
    I'm trying to run a simple bat file from windows that will run a bash script on linux machine. The bash script is located on the linux machine. For example: I'm trying to run this bat file from windows plink.exe -pw <password> root@<ip> bash -c "/root/script.sh" Result: When running from windows the cmd is stuck forever when running the specific script (/root/script.sh) from the linux machine it's working just fine. The script contain ruby code and I'm using RVM

    Read the article

  • echo newline character not working in bash

    - by Bashuser
    I have bash script which has lots of echo statements and also I aliased echo to echo -e both in .bash_profile and .bashrc, so that new lines are printed properly for a statement like echo 'Hello\nWorld' the output should be Hello World but the output I am getting is Hello\nWorld I even tried using shopt -s expand_aliases in the script, it doesn't help I am running my script as bash /scripts/scriptnm.sh; if I run it as . /scripts/scriptnm.sh I am getting the desired output...

    Read the article

  • Default prolog for all ZSH scripts?

    - by Igor Spasic
    I have a file that contains several helper functions, meant to be used only in other ZSH scripts. I do not want them to be loaded with my profile. To make these functions available in my script, I would need to source this file. Is it somehow possible to have automatic prolog script (or pre-script) loaded before all my ZSH scripts? My current idea is to alias -s zsh extension to custom function that those all this for me: concatenate prolog file and current script calls zsh with such modified input but for now I am somehow not able to do this (haven't sleep for almost a day). Please, does anyone have a working solution?

    Read the article

  • Not able to find scripts present in /etc/profile.d directory [on hold]

    - by priya
    I am using Red Hat Linux 6.0 ... using davinchi board. I have to change system clock resolution so I am changing (HZ) env var. For this I have written script so that I can change HZ = 1000 n insert that script in /etc/profile.d and write code for loop in /etc/profile so that while running as usual /etc/profile can load the scripts present in /etc/profile.d. But when I am logging into the system at root level then showing error as "-bash: ./etc/profile.d/resolution.sh(my script name): No such file or directory Also here why it is showing ./etc and not /etc . Is something related to that?? Also I tried to add script in /etc/init.d but still no change in value of HZ takes place. Please tell where to change so that this env var can get changed. The script(resolution.sh) written has :- #!/bin/bash export HZ=1000 The content of /etc/profile which I entered is: if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then .$i fi done unset i fi And the output of grep command is -rw-r--r-- 1 root root 535 Feb 4 2004 profile -rwxr-xr-x 2 root root 4096 Feb 2 2004 profile.d

    Read the article

  • Terminate child processes on ctrl-c

    - by jackweirdy
    In tiny core linux, I have the following script: #!/bin/sh # ~/.X.d/freerdp.sh rdp(){ while true do xfreerdp -f [IP Address] done } rdp & It's pretty simple; when X starts up and checks the .X.d directory (as is the case in tiny core) it finds and executes this script. The script starts up freerdp and keeps a connection open to the server by restarting it whenever it closes. As you can see from the rdp & line, the function is run in the background to allow X to continue its startup routine. The problem is that whenever I cancel X with a Ctrl-Alt-Backspace the rdp process doesn't die. I'm looking for a way to kill the process as soon as X finishes, either through: A) a script, executed on X closing, which kills the process or B) by modifying the script to check the return value of the xfreerdp command. NB - if the solution does check the return value, it must only end if the command fails to open the X display. For that reason, if you could point me to a reference for xfreerdp return values I'd be grateful.

    Read the article

  • Updating a script currently being ran by Task Scheduler on Windows

    - by orangechicken
    I have a scheduled task that runs a script on a ahem schedule ahem that updates a local git repo. This script is a file in this local git repo. Currently, what I'm seeing is that the script is ran, git complains that permissions are denied to write to file which actually results in the script being deleted! The next time the scheduled task runs the script file is now missing! How can I ensure that when I pull changes to this script from the repo that the file is actually updated?

    Read the article

  • Need info on scripts and Autoforward through Exchange Server in Outlook 2010

    - by user103037
    I am using the below information to auto-forward my work emails to my BB via a gmail account. The script works fine. But my work email ask's for every email to send either classifield or unclassified. What and where would I add into the below script to autoforward unclassified? I have written some VBA script to do this bypass the server's disabling of auto-forward. Basically it mimics the user forwarding the email rather than the server doing an auto-forward. It's pretty simple: Sub AutoForwardAllSentItems(Item As Outlook.MailItem) Dim strMsg As String Dim myFwd As Outlook.MailItem Set myFwd = Item.Forward myFwd.Recipients.Add "[email protected]" myFwd.Send Set myFwd = Nothing End Sub It's beyond the scope of this post to give detailed instructions, but here's a summary: Add the above code in the Visual Basic editor of Outlook (Alt-F11 should get your started). Be sure to change [email protected] to the address where you want the mail to go Tell Outlook to run this code for each inbound message (Tools - Rules and Alerts - New Rule - Check Messages when they arrive - Next - YES - Checkbox "Run a Script" - Then select the script you just created. Now Outlook should automatically forward each email you receive, but it won't be blocked by the Admin as an "Auto-forward".

    Read the article

  • Windows: How to add batch-script action to Right Click menu

    - by ervingsb
    I have a few programs that creates temp files or backup files or similar files that are not important. For example, GVim for Windows by default creates a backup file in filename.txt~. I sometimes need to clean up a dir and remove all these files. I have made a simple .bat file for this. However, it is cumbersome to have to start up cmd, navigate to the folder, run the script. Especially since this is a script that I would like to run often on various folders. And I do not want to copy the script to multiple folders, as this would be a maintenance nightmare. So, I was thinking, that the best solution would be to add a Right Click menu item that allows me to run the script. So that I can right click on a folder in Explorer and click Cleanup and then have my script run on this folder. So my question is: How do I add a right click menu action that runs a custom batch script?

    Read the article

  • GPO Startup Script can't modify HKU Registry?

    - by pepoluan
    I've been scratching my head with my current problem. You see, I have this Startup Script that I pushed via GPO. Problem is, although the script starts alright (I see the event it created when starting in the event log), it always fails when trying to enumerate and/or modify registry settings under HKU. If I login as administrator and execute the script manually, it works! If I startup a Command Prompt as SYSTEM (using the "at" workaround) and execute the script manually, it also works! If I reboot... the script always fails. Can anyone shed a light on my problem? Additional information: This script injects some registry values for the Local Administrator (i.e., S-1-5-21-etc etc etc-500), so I'm not sure that it's doable via GPP, not to mention that since nearly all the workstations in my domain are still using XP, so no guarantee of GPP support.

    Read the article

  • How to add extensions to a lot of files using content of each file?

    - by v8media
    I've got over 10,000 files that don't have extensions from older versions of the Mac OS. They're extremely nested, and they also have all sorts of strange formatting and characters. They don't have file types or creator codes attached to them any longer. A great deal of these files have text in the file that will let me determine extensions (for example Word.Document.8 is in every file created by that version of Word, and Excel.Sheet.8 in every file created with that version of Excel). I found a script that looks like it would work for one of these file types at a time, but it erases parts of filenames after nefarious characters, which is not good. find . -type f -not -name "." -print0 |\ xargs -0 file |\ grep 'Word.Document.8' |\ sed 's/:.*//' |\ xargs -I % echo mv % %.doc So, two questions from that: One is, should I clean the characters in the filenames first, or programmatically deal with those in the script in order to leave them the same? As long as I lose no information from the filenames, I don't see a problem cleaning out slashes and other problem characters. Also, if I clean the filenames, there are likely to be duplicates, so any cleaning script would have to add something like "-1" before the extension to make sure nothing gets lost. 2nd question is how do I change the script so that it will look for more than one file type at the same time and give each the proper extension? I'm not tied to this script, but it is understandable, which is a pro. Mac OS X 10.6 is installed on this file server, but I've got access to any recent versions of OS X. Thanks, Ian

    Read the article

  • How to know that my IP is invalid

    - by PeterMmm
    I have a script running that will start up an interface with a new IP. If the script comes up with an IP that is already in use i am in trouble. Is it possible that the script set up the new Ip, detects that this IP is already in use and then check the next one, until it finds an ip that works ? B=192.168.1. I=1 while [ "$I" != "256" ] do ifconfig eth0:1 $B.$I # check here that IP is Ok ! let "I=I+1" done

    Read the article

  • How can I get make JavaScript code execution to wait until an AJAX request with script is loaded and executed?

    - by Edward Tanguay
    In my application, I am using Ext.Ajax.request to load scripts which I execute with eval. The problem is that since it takes time for the AJAX request to complete, code that is executed afterward which needs variables which are in the script loaded in via AJAX. In this example, I show how this is the case. How can I change this code so that the execution of the JavaScript after the AJAX waits until the script in the AJAX call has been loaded and executed? testEvalIssue_script.htm: <script type="text/javascript"> console.log('2. inside the ajax-loaded script'); </script> main.htm: <html> <head> <script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script> <script type="text/javascript" src="ext/ext-all-debug.js"></script> <script type="text/javascript"> function loadViewViaAjax(url) { Ext.Ajax.request({ url: url, success: function(objServerResponse) { var responseText = objServerResponse.responseText; var scripts, scriptsFinder=/<script[^>]*>([\s\S]+)<\/script>/gi; while(scripts=scriptsFinder.exec(responseText)) { eval.call(window,scripts[1]); } } }); } console.log('1. before loading ajax script'); loadViewViaAjax('testEvalIssue_script.htm'); console.log('3. after loading ajax script'); </script> </head> <body> </body> </html> output: 1. before loading ajax script 3. after loading ajax script 2. inside the ajax-loaded script How can I get the output to be in the correct order, like this: 1. before loading ajax script 2. inside the ajax-loaded script 3. after loading ajax script

    Read the article

  • Trying to use Rhino, getEngineByName("JavaScript") returns null in OpenJDK 7

    - by Yuval
    When I run the following piece of code, the engine variable is set to null when I'm using OepnJDK 7 (java-7-openjdk-i386). import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public class TestRhino { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("JavaScript"); try { System.out.println(engine.eval("1+1")); } catch (ScriptException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } It runs fine with java-6-openjdk and Oracle's jre1.7.0. Any idea why? I'm using Ubuntu 11.10. All JVMs are installed under /usr/lib/jvm. I noticed OpenJDK 7 has a different directory structure. Perhaps something is not installed right? $ locate rhino.jar /usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar /usr/lib/jvm/java-7-openjdk-common/jre/lib/rhino.jar /usr/lib/jvm/java-7-openjdk-i386/jre/lib/rhino.jar Edit Since ScriptEngineManager uses a ServiceProvider to find the available script engines, I snooped around resources.jar's META-INF/services. I noticed that in OpenJDK 6, resources.jar has a META-INF/services/javax.script.ScriptEngineFactory entry which is missing from OpenJDK 7. Any idea why? I suspect this is a bug? Here is the contents of that entry (from OpenJDK 6): #script engines supported com.sun.script.javascript.RhinoScriptEngineFactory #javascript Another edit Apparently, according to this thread, the code simply isn't there, perhaps because of merging issues between Sun and Mozilla code. I still don't understand why it was present in OpenJDK 6 and not 7. The class com.sun.script.javascript.RhinoScriptEngineFactory exists in 6's rt.jar but not in 7's. If it was not meant to be included, why is there a OpenJDK 7 rhino.jar then; and why is the source still in the OpenJDK source tree (here)?

    Read the article

  • What is the best way to inject a javascript script from another domain into a page? (without using a

    - by lowellk
    Here is a snippet of javascript for loading a script onto a given page asynchronously. I was wondering if there was anything wrong with it? Can it be improved? I haven't played with this yet, but some things I'm worried about are: - cross browser support - when script.readyState is true, will the old version of that function get clobbered? - can i always count on there being a head or body element? Here it is: function injectScript(url, callback){ var script = document.createElement('script'); script.type = "text/javascript"; script.setAttribute('async', 'true'); script.src = url; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(script); if (callback) { if (script.readyState){ script.onreadystatechange = function(){ if(script.readyState === "loaded" || script.readyState === "complete"){ script.onreadystatechange = null; callback(); } }; }else{ script.onload = function() { callback(); } } } }

    Read the article

  • Google Apps Script: how to make suggest box library to work?

    - by Pythonista's Apprentice
    I'm trying to add an autocomplete feature in my Google Spreadsheet using this Google Apps Script suggest box library from Romain Vialard and James Ferreira's book: function doGet() { // Get a list of all my Contacts var contacts = ContactsApp.getContacts(); var list = []; for(var i = 0; i < contacts.length; i++){ var emails = contacts[i].getEmails(); if(emails[0] != undefined){ list.push(emails[0].getAddress()); } } var app = UiApp.createApplication(); var suggestBox = SuggestBoxCreator.createSuggestBox(app, 'contactPicker', 200, list); app.add(suggestBox); return app; } function onEdit() { var s = SpreadsheetApp.getActiveSheet(); if( s.getName() == "my_sheet_name" ) { //checks that we're on the correct sheet var r = s.getActiveCell(); if( r.getColumn() == 1) { doGet(); } } } But when I start editing the column 1 of "my_sheet_name" nothing hapens (if I replace doGet() for other function, this other function runs Ok). I've already installed the Suggest Box library. So, why the doGet() function doesn't work?

    Read the article

  • How to use a variable in a function expression which is injected in a page?

    - by anonymous
    I'm trying to inject a function into a webpage via Chrome extension content script by: function inject(code) { var actualCode = '(' + code + ')();'; var script = document.createElement('script'); script.textContent = actualCode; (document.head||document.documentElement).appendChild(script); script.parentNode.removeChild(script); } var myObj = person; // myObj/person is passed in from elsewhere var fn = function() { alert(myObj.name); }; inject(fn); // myObj undefined My issue is, since fn is a function expression, I can't pass in myObj.personName. So my question is, how can I construct a function expression that includes a variable? Do I do some sort of string concatenation instead? I also tried to pass the object to the function, as follows: function inject(code, myObj) { var actualCode = '(' + code + ')(' + myObj +');'; ... But this did not work, and caused a "Uncaught SyntaxError: Unexpected identifier" error. Related: Building a Chrome Extension - Inject code in a page using a Content script

    Read the article

  • how to run mysql drop and create synonym in shell script

    - by bgrif
    I have added this command to a script I am writing and I am running into a issue with it not logging onto mysql and running the commands. How can i fix this and make it run. #! /bin/bash Subject: Please stage the following TFL09143 Locator Bulletin to all TF90 staging environments: # This next section is to go to mysql server and make changes. you can drop and create synonyms truncate a table and insert into a different one. you will be able to verify the counts to the different locations # $ mysql --host=app03-bsi --u "" --p "" "TF90BPS" -bse "drop synonym TF90.BTXADDR && drop synonym TF90.BTXSUPB && CREATE SYNONYM TF90.BTXADDR FOR TF90BP.TFBPS2.BTXADDR && CREATE SYNONYM TF90.BTXSUPB FOR TF90BP.TFBPS3.BTXSUPB && TRUNCATE TABLE TF90BP.TFBPS3.BTXSUPB SELECT * FROM TF90BP.TFBPS2.BTXSUPB; select count () from TF90BP.TF90.BTXADDR select count() from TF90BPS.TF90.BTXADDR; select count() from TF90BP.TF90.BTXSUPB; select count() from TF90BPS.TF90.BTXSUPB;" $ mysql --host=app03-bsi --u "" --p "" "TF90LMS" -bse "drop synonym TF90.BTXADDR && drop synonym TF90.BTXSUPB && CREATE SYNONYM TF90.BTXADDR FOR TF90LM.TFBPS2.BTXADDR && CREATE SYNONYM TF90.BTXSUPB FOR TF90LM.TFBPS3.BTXSUPB; TRUNCATE TABLE TF90LM.TFLMS2.BTXADDR;TRUNCATE TABLE TF90LM.TFLMS3.BTXSUPB;INSERT INTO TF90LM.TFLMS3.BTXSUPB SELECT * FROM TF90LM.TFLMS2.BTXSUPB;Verify select count() from TF90LM.TF90.BTXADDR;select count() from TF90LMS.TF90.BTXADDR;select count() from TF90LM.TF90.BTXSUPB;select count() from TF90LMS.TF90.BTXSUPB" $ mysql --host=app03-bsi --u "" --p "" "TF90NCS" -bse "drop synonym TF90.BTXADDR && drop synonym TF90.BTXSUPB && CREATE SYNONYM TF90.BTXADDR FOR TF90NC.TFBPS2.BTXADDR && CREATE SYNONYM TF90.BTXSUPB FOR TF90NC.TFBPS3.BTXSUPB; TRUNCATE TABLE TF90NC.TFNCS2.BTXADDR; TRUNCATE TABLE TF90NC.TFNCS3.BTXSUPB; INSERT INTO TF90NC.TFNCS3.BTXSUPB SELECT * FROM TF90NC.TFNCS2.BTXSUPB; Verify select count() from TF90NC.TF90.BTXADDR; select count() from TF90NCS.TF90.BTXADDR;select count() from TF90NC.TF90.BTXSUPB;select count() from TF90NCS.TF90.BTXSUPB" $ mysql --host=app03-bsi --u "" --p "" "TF90PVS" -bse "drop synonym TF90.BTXADDR && drop synonym TF90.BTXSUPB && CREATE SYNONYM TF90.BTXADDR FOR TF90PV.TFBPS2.BTXADDR && CREATE SYNONYM TF90.BTXSUPB FOR TF90PV.TFBPS3.BTXSUPB; TRUNCATE TABLE TF90PV.TFPVS2.BTXADDR;TRUNCATE TABLE TF90PV.TFPVS3.BTXSUPB;INSERT INTO TF90PV.TFPVS3.BTXSUPB SELECT * FROM TF90PV.TFPVS2.BTXSUPB;Verify select count() from TF90PV.TF90.BTXADDR;select count() from TF90PVS.TF90.BTXADDR;select count() from TF90PV.TF90.BTXSUPB;select count() from TF90PVS.TF90.BTXSUPB" TFL09143 Staging cd \ntsrv\common\To\IT-CERT-TEST\TFL09143 #change to mapped network drive cp -p TFL09143.pkg /d:/tf90/code_stg && /tf90bp/code_stg && /tf90lm/code_stg && /tf90pv/code_stg # Copies the package from the networked folder and then copies to the location(s) needed.# InvalidInput="true" if [ $# -eq 0 ] ; then echo "This script sets up TF90 Staging" echo -n "Which production do you want to run? (RB/TaxLocator/Cyclic)" read ProductionDistro else ProductionDistro="$1" fi while [ "$InvalidInput" = "true" ] do if [ "$ProductionDistro" = "RB" -o "$ProductionDistro" = "TaxLocator" -o "$ProductionDistro" = "Cyclic" ] ; then InvalidInput="false" break else echo "You have entered an error" echo "You must type RB or TaxLocator or Cyclic" echo "you typed $ProductionDistro" echo "This script sets up TF90 Staging" read ProductionDistro fi done InvalidInput="true" if [ $# -eq 0 ] ; then echo "This script sets up RB TF90 Staging" echo -n "Which Element do you want to run? (TF90/TF90BP/TF90LM/TF90PV/ALL)" read ElementDistro else ElementDistro="$1" fi while [ "$InvalidInput" = "true" ] do if [ "$ElementDistro" = "TF90" -o "$ElementDistro" = "TF90BP" -o "$ElementDistro" = "TF90LM" -o "$ElementDistro" = "TF90PV" -o "$ElementDistro" = "ALL" ] ; then InvalidInput="false" break else echo "You have entered an error" echo "You must type TF90 or TF90BP or TF90LM or TF90PV" echo "you typed $ElementDistro" echo "This script sets up TF90 Staging" read ElementDistro fi done if [ "$ElementDistro" = "TF90" ] ; then cd /d/tf90/code_stg vim TFL09143.pkg export var=TF90_CONNECT_STRING=DSN=TF90NCS;export Description=TF90NCS;export Trusted_Connection=Yes;export WSID=APP03- BSI;export DATABASE=TF90NCS; export DATASET=DEFAULT pkgintall -l -v ../TFL09143.pkg fi if [ "$ElementDistro" = "$TF90BP" ] ; then cd /d/tf90bp/code_stg vim TFL09143.pkg export TF90_CONNECT_STRING=DSN=TF90BPS;export Description=TF90BPS;export Trusted_Connection=Yes;export WSID=APP03- BSI;export DATABASE=TF90BPS; start tfloader -l –v ../TFL09143.pkg fi if [ "$ElementDistro" = "$TF90LM" ] ; then cd /d/tf90lm/code_stg vim TFL09143.pkg export TF90_CONNECT_STRING=DSN=TF90LMS;export Description=TF90LMS;export Trusted_Connection=Yes;export WSID=APP03- BSI;export DATABASE=TF90LMS; start tfloader -l -v ../TFL09143.pkg fi if [ "$ElementDistro" = "TF90PV" ] ; then cd /d/tf90pv/code_stg vim TFL09143.pkg export TF90_CONNECT_STRING=DSN=TF90PVS;Description=TF90PVS;Trusted_Connection=Yes;WSID=APP03- BSI;DATABASE=TF90PVS; start tfloader -l –v ../TFL09143.pkg fi exit 0

    Read the article

  • Wishful Thinking: Why can't HTML fix Script Attacks at the Source?

    - by Rick Strahl
    The Web can be an evil place, especially if you're a Web Developer blissfully unaware of Cross Site Script Attacks (XSS). Even if you are aware of XSS in all of its insidious forms, it's extremely complex to deal with all the issues if you're taking user input and you're actually allowing users to post raw HTML into an application. I'm dealing with this again today in a Web application where legacy data contains raw HTML that has to be displayed and users ask for the ability to use raw HTML as input for listings. The first line of defense of course is: Just say no to HTML input from users. If you don't allow HTML input directly and use HTML Encoding (HttyUtility.HtmlEncode() in .NET or using standard ASP.NET MVC output @Model.Content) you're fairly safe at least from the HTML input provided. Both WebForms and Razor support HtmlEncoded content, although Razor makes it the default. In Razor the default @ expression syntax:@Model.UserContent automatically produces HTML encoded content - you actually have to go out of your way to create raw HTML content (safe by default) using @Html.Raw() or the HtmlString class. In Web Forms (V4) you can use:<%: Model.UserContent %> or if you're using a version prior to 4.0:<%= HttpUtility.HtmlEncode(Model.UserContent) %> This works great as a hedge against embedded <script> tags and HTML markup as any HTML is turned into text that displays as HTML but doesn't render the HTML. But it turns any embedded HTML markup tags into plain text. If you need to display HTML in raw form with the markup tags rendering based on user input this approach is worthless. If you do accept HTML input and need to echo the rendered HTML input back, the task of cleaning up that HTML is a complex task. In the projects I work on, customers are frequently asking for the ability to post raw HTML quite frequently.  Almost every app that I've built where there's document content from users we start out with text only input - possibly using something like MarkDown - but inevitably users want to just post plain old HTML they created in some other rich editing application. See this a lot with realtors especially who often want to reuse their postings easily in multiple places. In my work this is a common problem I need to deal with and I've tried dozens of different methods from sanitizing, simple rejection of input to custom markup schemes none of which have ever felt comfortable to me. They work in a half assed, hacked together sort of way but I always live in fear of missing something vital which is *really easy to do*. My Wishlist Item: A <restricted> tag in HTML Let me dream here for a second on how to address this problem. It seems to me the easiest place where this can be fixed is: In the browser. Browsers are actually executing script code so they have a lot of control over the script code that resides in a page. What if there was a way to specify that you want to turn off script code for a block of HTML? The main issue when dealing with HTML raw input isn't that we as developers are unaware of the implications of user input, but the fact that we sometimes have to display raw HTML input the user provides. So the problem markup is usually isolated in only a very specific part of the document. So, what if we had a way to specify that in any given HTML block, no script code could execute by wrapping it into a tag that disables all script functionality in the browser? This would include <script> tags and any document script attributes like onclick, onfocus etc. and potentially also disallow things like iFrames that can potentially be scripted from the within the iFrame's target. I'd like to see something along these lines:<article> <restricted allowscripts="no" allowiframes="no"> <div>Some content</div> <script>alert('go ahead make my day, punk!");</script> <div onfocus="$.getJson('http://evilsite.com/')">more content</div> </restricted> </article> A tag like this would basically disallow all script code from firing from any HTML that's rendered within it. You'd use this only on code that you actually render from your data only and only if you are dealing with custom data. So something like this:<article> <restricted> @Html.Raw(Model.UserContent) </restricted> </article> For browsers this would actually be easy to intercept. They render the DOM and control loading and execution of scripts that are loaded through it. All the browser would have to do is suspend execution of <script> tags and not hookup any event handlers defined via markup in this block. Given all the crazy XSS attacks that exist and the prevalence of this problem this would go a long way towards preventing at least coded script attacks in the DOM. And it seems like a totally doable solution that wouldn't be very difficult to implement by vendors. There would also need to be some logic in the parser to not allow an </restricted> or <restricted> tag into the content as to short-circuit the rstricted section (per James Hart's comment). I'm sure there are other issues to consider as well that I didn't think of in my off-the-back-of-a-napkin concept here but the idea overall seems worth consideration I think. Without code running in a user supplied HTML block it'd be pretty hard to compromise a local HTML document and pass information like Cookies to a server. Or even send data to a server period. Short of an iFrame that can access the parent frame (which is another restriction that should be available on this <restricted> tag) that could potentially communicate back, there's not a lot a malicious site could do. The HTML could still 'phone home' via image links and href links potentially and basically say this site was accessed, but without the ability to run script code it would be pretty tough to pass along critical information to the server beyond that. Ahhhh… one can dream… Not holding my breath of course. The design by committee that is the W3C can't agree on anything in timeframes measured less than decades, but maybe this is one place where browser vendors can actually step up the pressure. This is something in their best interest to reduce the attack surface for vulnerabilities on their browser platforms significantly. Several people commented on Twitter today that there isn't enough discussion on issues like this that address serious needs in the web browser space. Realistically security has to be a number one concern with Web applications in general - there isn't a Web app out there that is not vulnerable. And yet nothing has been done to address these security issues even though there might be relatively easy solutions to make this happen. It'll take time, and it's probably not going to happen in our lifetime, but maybe this rambling thought sparks some ideas on how this sort of restriction can get into browsers in some way in the future.© Rick Strahl, West Wind Technologies, 2005-2012Posted in ASP.NET  HTML5  HTML  Security   Tweet !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })();

    Read the article

  • SQL SERVER – Demo Script – Keeping CPU Busy

    - by pinaldave
    Recently face very interesting situation, during presentations at event, I was asked very famous questions: “My CPU is very high all the time, how can I reduce it?” This is very interesting question and there are many answers and a single blog post is not good enough to justify this subject. I presented few situation to the person who asked the question. The member of the audience who asked question came to me afterwords and asked me few detailed questions. To answer him, I quickly wrote query which simulate high CPU. Here is the script which I wrote which increased CPU from 10% to 80%. I was wondering if there is any similar script which can simulate high CPU usage. If you have share with me and I will publish with due credit. Here is my script for the same: USE AdventureWorks GO DECLARE @Flag INT SET @Flag = 1 WHILE(@Flag < 1000) BEGIN ALTER INDEX [PK_SalesOrderDetail_SalesOrderID_SalesOrderDetailID] ON [Sales].[SalesOrderDetail] REBUILD SET @Flag = @Flag + 1 END GO   Reference: Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, PostADay, SQL, SQL Authority, SQL Query, SQL Scripts, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Script Task/Component and Template Information

    The Script Task and Script component are often used by people developing SSIS packages because they are easy to use and now because SSIS could be perceived to be more developer friendly they are very powerful. That being said we should no be using them everywhere.  There are generally Tasks/Components already provided that will do the job it may be that we have to rethink the way we want to draw our package. I had cause last week to break out the script component in SQL Server 2008 SP1 and found that it was broken.  I don’t know when it broke as I do not use them all that often.  My error was as below.     Something must have overwritten this template information.  I looked in Event Viewer and tried the things it suggested but the templates still did not work.  Here is how I got them eventually to work for me (Your Mileage may vary) Open up a Command Prompt window using an administrator level account and “as an administrator” vsta.exe /hostid SSIS_ScriptTask /setup vsta.exe /hostid SSIS_ScriptComponent /setup   This worked for me.  Hope it helps.

    Read the article

  • Bash script not adding variables to session

    - by travega
    I have a bash script that I have added as a startup application. It does a bunch of exports and alias assignment. #! /bin/bash alias devhm='cd ${DEV_HOME}; ll'; alias wlhm='cd ${WL_HOME}; ll'; alias dirch='watch --interval=1 "ls -la"'; alias vols='watch --interval=1 "df -h"'; alias svn-update='svn update --depth infinity ./*'; alias mci="~/mci.sh"; alias vncserver="vncserver -geometry 1680x1050"; alias ..="cd .."; alias hist="history | grep "; export PROXY_HOST=proxy.my.setup; export PROXY_PORT=3128; export LD_LIBRARY_PATH=$LD_LIBRARY_PATH/usr/lib/oracle/12.1/client64/lib; export ORACLE_HOME=/usr/lib/oracle/12.1/client64; export TNS_ADMIN=${ORACLE_HOME}/network/admin; echo "DONE!"; But none of these values are available in my terminal sessions anymore. Even when I run the script straight into the terminal like so: ./setup.sh I see the "DONE!" prompt printed but no aliases or env variables are set. If I copy and paste the contents of the file into the terminal the aliases and env variables are set. I have tried adding a line to execute the script from .bashrc also but still no aliases or env variables set. Any ideas what might be going on here? Also could anyone suggest a better way to have these env variables/aliases added to every terminal session?

    Read the article

  • korgac - init.d kill script on shutdown

    - by Max Magnus
    I'm new to Ubuntu 12.04 and Linux and my English is not the best, so I'm sorry for incorrect or stupid questions. I've installed KOrganizer and to start the reminder when I boot the system, I added the korgac command to the autostart. This works fine. But now, every time I want to reboot or shutdown my system, there appears a message that tells me that an unknown process is still running... so I have kill it manually before reboot/shutdown. I knew that it is the korgac process that causes this problem, so I decided to create an init.d script. I've created a script, put it into init.d, and created 2 symbolic links: to rc0.d and to rc6.d. The name starts with K10script... (I hope it is correct so). K10korgac_kill: #! /bin/sh pkill korgac exit 0 Unfortunately this wasn't able to resolve my problem. Maybe my script is wrong. I hope someone can help me. Thanks for your time Max

    Read the article

  • How can I run this script on startup, restart, and shutdown?

    - by Exeleration-G
    I'm using Ubuntu 11.10. I've written a script, that synchronises a directory in ~ with a directory on /dev/sda4, using Unison. Before, I had this script running every five minutes with no problems, using crontab. Right now, I want to execute this script at startup, restart and shutdown only. This is what the script looks like: #!/bin/bash unison -perms 0 -batch "/mnt/Data/Syncfolder/" "/home/myname/Syncfolder/" My crontab configuration was as follows: m h dom mon dow command 0,5,10,15,20,25,30,35,40,45,50,55 * * * * sh /usr/local/bin/s4lj.bash Note that I copied the script from ~ to /usr/local/bin/ first, to avoid root problems. I've read How to execute script on shutdown? and How to write an init script that will execute an existing start script?. After doing that, I've done this: I've made s4lj.bash executable, and then copied it to /etc/init.d/. For startup, I've made a symlink in /etc/rc2.d/ to /etc/init.d/s4lj.bash, and renamed it to S70s4lj.bash. For restart, I've made a symlink in /etc/rc6.d/ to /etc/init.d/s4lj.bash, and renamed it to K70s4lj.bash. For shutdown, I've made a symlink in /etc/rc0.d/ to /etc/init.d/s4lj.bash, and renamed it to K70s4lj.bash. Still, the script won't be run in any of these situations. How can I make the script get executed? I'd be happiest with a proper *.conf file in /etc/init. Thanks in advance.

    Read the article

  • Allow user to SUDO a script without password.

    - by John Isaacks
    I have a php script with this: <?php #echo exec('whoami'); $output = shell_exec('bash /usr/local/svn/bash_repo/make-live'); echo "$output"; ?> The make-live script contains this: #!/bin/bash cd /var/www-cake sudo svn checkout file:///usr/local/svn/bash_repo/repo/ echo "Head revision has been pushed to live server" So the PHP user who is www-data needs to have nopasswd for that script. I am told I need to add: www-data ALL=NOPASSWD: /usr/local/svn/bash_repo/make-live To sudoers to allow this. First I run sudo visudo but I have no experience with vi so I try to open it in gedit with export EDITOR=gedit && sudo -E visudo which then just opens a sudoers.tmp file which is empty. I add the line and save it. But it doesn't do save. So I just try sudo visudo and I add the line right beneath this part: # User privilege specification root ALL=(ALL) ALL www-data ALL=NOPASSWD: /usr/local/svn/bash_repo/make-live I closed out sudoers and reopened to verify that it has saved. I even restart apache. I run the php file and it still doesn't work. What am I missing?

    Read the article

  • Script Task/Component and Template Information

    The Script Task and Script component are often used by people developing SSIS packages because they are easy to use and now because SSIS could be perceived to be more developer friendly they are very powerful. That being said we should no be using them everywhere.  There are generally Tasks/Components already provided that will do the job it may be that we have to rethink the way we want to draw our package. I had cause last week to break out the script component in SQL Server 2008 SP1 and found that it was broken.  I don’t know when it broke as I do not use them all that often.  My error was as below.     Something must have overwritten this template information.  I looked in Event Viewer and tried the things it suggested but the templates still did not work.  Here is how I got them eventually to work for me (Your Mileage may vary) Open up a Command Prompt window using an administrator level account and “as an administrator” vsta.exe /hostid SSIS_ScriptTask /setup vsta.exe /hostid SSIS_ScriptComponent /setup   This worked for me.  Hope it helps.

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >