[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Scripting Languages

27K

Solutions

20K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.

Share tech news, updates, or what's on your mind.

Sign up to Post

I'll need a Shell (Bash) script (rather an exact command) that outputs

a)  files' name in the Solaris system, one file per line in the UNIX systems
b) that were modified/created the last 1470 minutes
c) exclude FIFO files, symbolic links, sockets (ie *.sock)
d) names of files of between 1 byte to 20MB in size
e) files in /dev, /devices, /kernel, /cdrom, /platform, /proc, /net
f) files mounted on NFS

I have about 1million files so hoping the command/script of outputting
the file can complete in 30mins, so may need efficient coding.


I need to amend the following script to read (ie for AV to scan) the above output file:

#!/bin/bash
LOGFILE="/var/log/clamav/`hostname`-$(date +'%Y-%m-%d').log";
## suggest to change dirs below to root but exclude databases
DIRTOSCAN="/var /opt /home /etc /tmp /export";

for S in ${DIRTOSCAN}; do
DIRSIZE=$(du -sh "$S" |grep -v "/proc" |grep -v "/dev" |grep -v ...  /2>/dev/null | cut -f1);
## add to grep -v for any other file types to exclude

echo "Starting a daily scan of "$S" directory.
Amount of data to be scanned is "$DIRSIZE".";

clamscan -ri "$S" >> "$LOGFILE";
0
Rowby Goren Makes an Impact on Screen and Online
LVL 12
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

I would like to modify the following script so that it will embed the contents of the source file in the body of the email:

The source file is at:

C:\Users\User\Desktop\File\file.txt


[code][/###PROGRAM START###
      # Invokes the Send-MailMessage function to send notification email
      $splat = @{
            From =                  'email1@email.com'
            To =                  Get-Content -Path ( Join-Path $PSScriptRoot 'DistList..txt')
            SmtpServer =      'smtp.smtp.com'
            Subject =            $subject
            body =                  $MessageBody
            BodyAsHtml =      $true
      }
      Send-MailMessage @splat
###PROGRAM END###code]
0
I have this bit of C Code for a project I working on for a project.  
logit("Username: %s Password: %s", authctxt->user, password);

Open in new window

This is going to be used in a proof of concept project and I want to obscure the real password.  I was thinking of either replacing the whole password with a set of characters or maybe keeping the first and last two characters and replacing the rest with a set of characters.  Maybe Xs.   Looking for suggested modification.
0
I have a setup of 2 PC's connected in Master and Slave configuration through a network cable with Windows 7 OS on both PC's. I need to stop a exe program and do a replace of the corrupted files  in a saved location and restart the exe program through vbscript with progress bar.  Can someone help with a vbscript or guidance? I am not a programmer. The progress should be shown on the master

Thanks in advance,
Vicki
1
Need a python script to copy yesterday files to a destination location and gzip them in destination directory
0
I am looking to copy and paste data from one xlsx sheet to a new excel sheet using VBScripts . Could please some one help me using Vb script to paste exact contents from
excel-input.xlsx to a new excel excel-output,xlsx on sheet2   and rename sheet2 to DataSet.

Here is the

Excel-Input.xlsx
Name      age      gender      department      year
don                23      male      computer      2010
ptalakes       24      female      maths              2015
chang      28      male      arts                2016
prag      29      female      science              2018
tom               26      male      arts                      2017
john      27      female      sports              2018
simon      22      male      arts                      2018

Excel-Output.xlsx  (Rename sheet2 as data )
Name      age      gender      department      year
don                23      male      computer      2010
ptalakes       24      female      maths              2015
chang      28      male      arts                2016
prag      29      female      science              2018
tom               26      male      arts                      2017
john      27      female      sports              2018
simon      22      male      arts                      2018
Excel-input.xlsx
Excel-Output.xlsx
0
need an archival script that runs on a nighty basis

we maintain our logs for a given month in a directory

/a/b/c/2018-01/xyz-2018-01-01-1.log
/a/b/c/2018-01/xyz-2018-01-01-2.log
/a/b/c/2018-01/xyz-2018-01-01-3.log
/a/b/c/2018-01/xyz-2018-01-02-1.log
/a/b/c/2018-01/xyz-2018-01-01-2.log
.
.
.
/a/b/c/2018-02/xyz-2018-02-01-1.log
/a/b/c/2018-02/xyz-2018-02-01-2.log
.
.
.
/a/b/c/2018-02/xyz-2018-02-31-1.log
/a/b/c/2018-02/xyz-2018-02-31-2.log

on a nightly basis we have to copy logs to corresponding months folder with date and tar and gzip

if the directory does not exist for the month we have to create it when copy and tar the files,

ex : /a/b/c/archieve/`date +`'%Y-%m'`/`

we should be maintaining the archived files for the last 3 days and hould be removed older than 3 days
0
How can I modify this script so that it pulls the BCC emails from a file, a text file for instance?

SubjectDate = InputBox("Date to be added to the subject:", "Enter date")
MailTo = "email1@gmail.com"
From = "mainemail@someprovider.com"
Subject = "This is a test " & SubjectDate
Body = "Hi, This is an VBScript to send email, Regards, User."
Username = "mainemail@someprovider.com"
Password = "passwordhere"
BCC = "email2@gmail.com"

Email MailTo, BCC, From, Subject, Body, Username, Password

Sub Email (MailTo, BCC, From, Subject, Body, Username, Password)
 Set objMessage = CreateObject("CDO.Message")
 With objMessage
  .Subject = Subject
  .From = From
  .To = MailTo
  .BCC = BCC
  .TextBody = Body
 End With
 With objMessage.Configuration.Fields
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mainemail@someprovider.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordhere"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Update
      End With
      Set

Open in new window

1
Is there a way to convert .xls to .csv?
if yes, how can this be done in an automated way?
0
How to search pdf files for a key word like "Sticky" and report those pdf files with that key word. One example is attached.

Regards,

Dallag
CONCLUSIONS-AND-RESULTS.pdf
0
Become a Certified Penetration Testing Engineer
LVL 12
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Using pdftk what command can I use to join files, first in the order of the file that was created first?

For example, let's say in the path C:\Attachment, there are 4 file all with different names, however all with different time stamps...

How can I modify this command so that it joins each file it finds but based on time stamp? all into 1 file?

pushd "C:\Users\Desktop\Folder"
pdftk ….. cat output C:\Attachment\OneFile.pdf
popd
0
I would like to change the following script so that whatever pdf file or files that it sees in C:\Attachment\..., that it will send that file, or files as an attachment.

###PROGRAM START###
	# Invokes the Send-MailMessage function to send notification email
	$splat = @{
		From =                  'email1@mail.com'
		To =                  Get-Content -Path ( Join-Path $PSScriptRoot 'List.txt')
		SmtpServer =      'snto,server,cin'
		Subject =            $subject
		body =                  $MessageBody
		BodyAsHtml =      $true
		Attachment =      ( Join-Path $PSScriptRoot '*.pdf' )
	}
	Send-MailMessage @splat
###PROGRAM END###

Open in new window

1
Hi,

I am working through the process of automating my backups in AWS. I have a process to take VSS snapshots of my volumes, and I also have a separate script in AWS Lambda which can automatically take an AMI. What i'm now looking to do is combine these in to one single function. The lambda script does take a snapshot, however I'm not certain that it's a VSS2 snapshot. I've googled the issue but all the articles I've come across seem to describe the two processes as separate entities.

This is the Python script I'm using in Lambda to take an AMI:

# Automated AMI Backups
#
# @author Robert Kozora <bobby@kozora.me>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
#
# After creating the AMI it creates a "DeleteOn" tag on the AMI indicating when
# it will be deleted using the Retention value and another Lambda function

import boto3
import collections
import datetime
import sys
import pprint

ec = boto3.client('ec2')
#image = ec.Image('id')

def lambda_handler(event, context):
   
    reservations = ec.describe_instances(
        Filters=[
            {'Name': 'tag-key', 'Values': ['backup', 'Backup']},
        ]…
0
what commands in vbs will move files out from one folder to another?
0
I am trying to display a custom message when a user closes or about to close a browser tab. In the earlier versions of the browsers I could do this using onunload or onbeforeunload events and display a pop-up message but the newer versions do not allow me to customize the message. Is there anyway I can display a customized message when the user closes the browser tab or when clicks on the close button of the browser tab? A tool-tip could also work when the user is hovering on the close button or clicks on the close button of the browser. Thank you for any help.
0
What are the strings of commands in CUTEFTP to download all files found in a specific remote folder?
Either it can override all local files, or it should only download the latest files it finds which are not on the local folder.
0
I would like to modify this FTP script below so that it does the following

1. Download any new files to the local directory.  (So the script needs to determine what it downloaded last time, so that it doesn't download it again, unless it it's easier to write the script so as to download everything it sees in the remote directory to the local directory and just overwrite any files which it sees, which is ok as well, in this scenario).

2. Does not delete the previous files from the remote directory.


@echo off
setlocal 

set password=xxxxxxxxxx
set /p password=<%~nx0:password
if not "%password%"=="" goto OK
set /p password=Enter password: 
echo %password%>%~nx0:password
:OK

set localdir=\\server1\main\
set remotedir=/out
set ftpserver=xxxxx.xxxxxxxxxxx.com
set username=xxxxxxxx

::del "%localdir%\*.*" /q

call :GetFtpFiles
call :ClearFTPFiles

exit /b

:GetFTPFiles
    (echo open %ftpserver%
    echo user %username% %password%
    echo bin
    echo cd %remotedir%
    echo lcd "%localdir%"
    echo mget *.*
    echo quit
    ) | ftp -n -i
    exit /b

:ClearfTPFiles
    (echo open %ftpserver%
    echo user %username% %password%
    echo cd %remotedir%
    (for /f "tokens=*" %%a in ('dir /b /a-d "%localdir%\*.*"') do @echo dele "%%~a")
    echo quit
    ) | ftp -n -i -d

Open in new window

0
I woud like to modify this email VBS script as follows.

1. Add BCC emails (perhaps from a ,txt file which is best)
2. Add a Reply to email as well

SubjectDate = InputBox("Date to be added to the subject:", "Enter date")
MailTo = "email1@gmail.com"
From = "mainemail@someprovider.com"
Subject = "This is a test " & SubjectDate
Body = "Hi, This is an VBScript to send email, Regards, User."
Username = "mainemail@someprovider.com"
Password = "passwordhere"
Email MailTo, From, Subject, Body, Username, Password

Sub Email (MailTo, From, Subject, Body, Username, Password)
 Set objMessage = CreateObject("CDO.Message")
 With objMessage
  .Subject = Subject
  .From = From
  .To = MailTo
  .TextBody = Body
 End With
 With objMessage.Configuration.Fields
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.mail.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
      .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mainemail@someprovider.com"
      .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "passwordhere"
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
      .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
      .Update
	End With
	Set objFSO 

Open in new window

0
I would like to change this script so that the BCC is taken from a text file called A.txt


[code][/$username = "email1@gmail.com"
$password = "password"
$sendMailArgs = @{
      To =                  "email2@gmail.com"
      From =                  $username
      Cc =                  "email3@gmail.com"
      Bcc =                  
      Subject =                  "File"
      Body =                  "Here is the file"
      Attachments =            "C:\Users\Joe\Desktop\Folder\PDFFile.pdf"
      SmtpServer =            "smtp.mail.com"
      Port =                  000
      UseSsl =                  $true
      Credential =            New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $username, (ConvertTo-SecureString $password -AsPlaintext -Force)
}
Send-MailMessage @sendMailArgs
Write-Host "Mail Sent"code]
0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

I prefer to do this with batch, I've done lots of research and feel that I have like an 80-85% solution I just need some help to get me over the top and clean it up a bit and add some stuff I don't have working yet

batch file to compare 2 folders checking to see if files exist in both folders
if the file exists in folder A and in folder  B then copy it to an archive folder
log the file that is being copied and add the YYYYMMDD to the filename

>>>>>>>start script


@echo on

rem To add YYYYMMDD stamp to files copied to the archive folder

for /f "tokens=1-4 delims=/ " %%i in ("%date%") do (
set week=%%i
set day=%%j
set month=%%k
set year=%%l
)

setlocal
rem set variables for folder and network share location to compare files
set movedir=c:\move
set netdir= "\\name\folder"
set archivedir= c:\archive


rem set variable for log folder and log file
set logfile=c:\logpath\logfile.txt

rem check for the archive directory if it doesn't exist create the directory

if not exist "c:\archive" ( echo Creating Archive directory
mkdir "c:\archive"
)

rem map network path
echo Mapping Network location X:

net use x: "%netdir%"

echo Compare Move directory to a Network share

rem Check all files in folder move and Network share with a for loop ???

if the files exist in both directories then copy to archive and add a date stamp to name and log the files that were copied to the archive folder to the c:\logpath\logfile.txt

rem I believe …
0
Hi all

I have this script :

Get-WmiObject -ComputerName 'dc1' -Class Win32_NetworkAdapter | `
    Where-Object { $_.Speed -ne 2000000000 -and $_.MACAddress -ne $null } | `
    Format-list -Property SystemName,Name,NetConnectionID,Speed,MACAddress

And I would like to receive a e-mail alert when $_.Speed -ne 2000000000 condition is match

I need help, Please

Thank you

CK
0
I would like to change this script so that the output is on the screen as opposed to a file:

[code][/Write-Host "Reading your inbox...`n`n"  
# Folder IDs
#$olAppointmentItem = 1
#$olFolderDeletedItems = 3
#$olFolderOutbox = 4
#$olFolderSentMail = 5
$olFolderInbox = 6
#$olFolderCalendar = 9
#$olFolderContacts = 10
#$olFolderJournal = 11
#$olFolderNotes = 12
#$olFolderTasks = 13
#$olFolderDrafts = 16  
# Connect to Outlook Inbox
 
 
$outlook = New-Object -ComObject Outlook.Application
$session = $outlook.Session
$session.Logon()
$inbox = $outlook.session.GetDefaultFolder($olFolderInbox)  
$inbox = (%{$inbox.items | where {$_.UnRead -eq "$True"}}) |
Select-Object -Property ReceivedTime, SenderName, Importance, Subject
 
# Count number of unread items in INBOX
#$unreadCount = (%{$inbox.item | where {$_.UnRead}})
# Select-Object -Property Subject, ReceivedTime, Importance, SenderName, Unread
#Get Mailbox User's First Name
#$firstName = $outlook.Session.CurrentUser.Name.Split()[0]  
# Say it
#Write-Host $inbox1
$Output = Write-Output $inbox | Export-Csv "C:\Users\emancuso\Desktop\Email.csv" -NotypeInformation -encoding "unicode" -delimiter "`t" code]
0
I would like to modify this script to first check to see how many Unread emails there are, display it, and then if there are unread emails to continue to show only the information for the Unread emails.

$mail="email1@email.com"
$password="passwordhere"

# Set the path to your copy of EWS Managed API 
$dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\2.2\Microsoft.Exchange.WebServices.dll" 
# Load the Assemply 
[void][Reflection.Assembly]::LoadFile($dllpath) 

# Create a new Exchange service object 
$service = new-object Microsoft.Exchange.WebServices.Data.ExchangeService 

#These are your O365 credentials
$Service.Credentials = New-Object Microsoft.Exchange.WebServices.Data.WebCredentials($mail,$password)

# this TestUrlCallback is purely a security check
$TestUrlCallback = {
    param ([string] $url)
    if ($url -eq "https://autodiscover-s.outlook.com/autodiscover/autodiscover.xml") {$true} else {$false}
}
# Autodiscover using the mail address set above
$service.AutodiscoverUrl($mail,$TestUrlCallback)

# create Property Set to include body and header of email
$PropertySet = New-Object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)

# set email body to text
$PropertySet.RequestedBodyType = [Microsoft.Exchange.WebServices.Data.BodyType]::Text;

# Set how many emails we want to read at a time
$numOfEmailsToRead = 10

# Index to keep track of where we are up to. Set to 0 initially.

Open in new window

0
Is there a script that has the ability to look inside a pdf document and search for a specific text/phrase.. and if it finds it can the script indicate that it found the text?
0
Hello,

Please, can you help me;
In fact we need to display the google site "www.google.com" in my web page but when we used <iframe> we obtained a white window ;
Do you have any idea to display the google page in my site

code :

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
  <title>Untitled 1</title>
<p>Click on link bellow to change iframe content:</p>
<a href="http://www.bing.com" target="search_iframe">Bing</a> -
<a href="http://en.wikipedia.org" target="search_iframe">Wikipedia</a> -
<a href="http://google.com" target="search_iframe">Google</a> (not allowed in inframe)
<iframe src="http://en.wikipedia.org" width="100%" height="100%" name="search_iframe"></iframe>
</body>
</html>

Best regards,
0

Scripting Languages

27K

Solutions

20K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.