This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo | openssl s_client -connect ${SERVER}:${PORT} 2>/dev/null | openssl x509 -text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use following dependency: | |
<dependency> | |
<artifactId>oshi-core</artifactId> | |
<groupId>com.github.oshi</groupId> | |
<version>3.11.0</version> | |
</dependency> | |
and use this code: | |
public static String getCPUId() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#name this file as ~/bin/checkSshAgent.sh and put at the end of your ~/.bash_profile as shown below (remove the ##) | |
## | |
## . ~/bin/checkSshAgent.sh | |
## | |
AGENT_PID=`ps -ef | grep ssh-agent | grep -v grep | awk '{print $2;}'` | |
if [ -f ~/.ssh/agent-info ] | |
then | |
echo Agent info exists | |
else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@GrabResolver(name='jitpack.io', root='https://jitpack.io') , | |
@Grab('org.slf4j:slf4j-log4j12:1.7.7') , | |
@Grab('com.h2database:h2:1.4.196') , | |
@Grab('com.github.krishnact:commandlinetool-base:0.4.10') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-sql') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-cli-commons') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-json') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-xml') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-templates') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@GrabResolver(name='jitpack.io', root='https://jitpack.io'), | |
@Grab('org.slf4j:slf4j-log4j12:1.7.7'), | |
@Grab('com.h2database:h2:1.4.196'), | |
@Grab('com.github.krishnact:commandlinetool-base:0.4.10'), | |
@Grab('org.apache.sshd:sshd-core:2.1.0'), | |
@Grab('org.apache.sshd:sshd-cli:2.1.0'), | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-sql') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-cli-commons') , | |
@GrabExclude(group = 'org.codehaus.groovy', module='groovy-json') , |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log4j.rootLogger=INFO, consoleAppender, firstFileLogger | |
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender | |
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout | |
# Print the date in ISO 8601 format | |
log4j.appender.consoleAppender.layout.ConversionPattern=%d [%t] %-5p %c - %m%n | |
# Define the file appender | |
log4j.appender.firstFileLogger=org.apache.log4j.RollingFileAppender | |
# Set the name of the file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python3 support | |
from __future__ import print_function | |
from __future__ import unicode_literals | |
import socks | |
import socket | |
# import helpers | |
from napalm.base import get_network_driver | |
from napalm.base.clitools import helpers | |
# stdlib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String encrypt_decrypt(String data, String symmKey, int encOrDec) { | |
String ALGO = "AES"; | |
javax.crypto.spec.SecretKeySpec key = new javax.crypto.spec.SecretKeySpec(symmKey.md5().toString().decodeHex(), ALGO); | |
javax.crypto.Cipher c = javax.crypto.Cipher.getInstance(ALGO); | |
String retVal = ""; | |
if (encOrDec == 1) { | |
c.init(javax.crypto.Cipher.ENCRYPT_MODE, key); | |
byte[] encVal = c.doFinal(data.getBytes("UTF-8")); | |
retVal= new String(encVal.encodeHex().toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Creates JWT token for InfluxDB | |
INFLUXDB_USER_NAME=$1 | |
NUMBER_OF_DAYS=$2 | |
NOW_SEC=$(date +%s) | |
NUMBER_OF_SECONDS=$((NUMBER_OF_DAYS*86400)) | |
EXP_TIME=$((NOW_SEC+NUMBER_OF_SECONDS)) | |
SECRET=$3 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACTION=$1 | |
KEY=$2 | |
SRCFILE=$3 | |
OUTFILE=$4 | |
function usage(){ | |
echo $0 '[encrypt|decrypt] KEYFILE SRCFILE OUTFILE' | |
echo for decrypt KEYFILE is private Key file |