Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 7d7b529efe8bbb7e9afe7bc00f9c3bc4543345fc @scottdware committed Nov 6, 2012
Showing with 246 additions and 0 deletions.
  1. +22 −0 .gitattributes
  2. +163 −0 .gitignore
  3. +25 −0 README.md
  4. +36 −0 vpn.slax
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
@@ -0,0 +1,163 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
@@ -0,0 +1,25 @@
+# junos-vpn #
+
+This is a simple [1]SLAX script that when run, will display the current, active IPSec VPN tunnels on the device.
+
+## Usage ##
+
+There are few ways that you can run this script. One option is to upload it to the device, and run it from
+there:
+
+`scp vpn.slax user@device:/var/db/scripts/op/`
+
+Once it is uploaded, you can run the following command from *operational* mode:
+
+`op url /var/db/scripts/op/vpn.slax`
+
+You can also enter in the following configuration:
+
+`set system scripts op file vpn.slax`
+
+...then you can just run `op vpn` from operational mode.
+
+Another way is to run the script remotely, calling it via ftp, sftp, or scp. The latter two are preferred:
+
+`op url scp://user:password@device/path/to/vpn.slax`
+
@@ -0,0 +1,36 @@
+/*
+* Author: Scott Ware <scottdware@gmail.com>
+* Title: vpn.slax
+* Description: A simple script that displays the current active IPSec VPN
+* tunnels.
+*/
+version 1.0;
+
+ns junos = "http://xml.juniper.net/junos/*/junos";
+ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
+ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
+
+import "../import/junos.xsl";
+
+match / {
+ <op-script-results> {
+ var $show-sec-ike-sa := {
+ <get-ike-security-associations-information>;
+ }
+ var $get-sec-ike-sa = jcs:invoke($show-sec-ike-sa);
+ var $tunnels = count($get-sec-ike-sa//ike-security-associations);
+
+ expr jcs:output("Host\t\t\tTunnel State\tIndex\n");
+ expr jcs:output("--------------------------------------------------\n");
+
+ if ($tunnels <= 0) {
+ expr "No active IPSec VPN tunnels!\n";
+ }
+ else {
+ for-each ($get-sec-ike-sa//ike-security-associations) {
+ <output> ike-sa-remote-address _ "\t\t" _ ike-sa-state _ "\t\t" _ ike-sa-index;
+ }
+ }
+ }
+}
+

0 comments on commit 7d7b529

Please sign in to comment.