Skip to content

Instantly share code, notes, and snippets.

View rohityadavcloud's full-sized avatar

Rohit Yadav rohityadavcloud

View GitHub Profile
@rohityadavcloud
rohityadavcloud / vnc-decrypt.sh
Last active June 29, 2023 17:02
vnc-decrypt: CloudStack VNC Password decryption tool
#!/bin/bash
# Usage comment out code that you don't need per your CloudStack version
input=$(mysql -u root -proot -e "select vnc_password from cloud.vm_instance where name='$1'\G;" | grep vnc_password | sed 's/.*vnc_password: //')
# For older ACS versions:
java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.0.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$input password=password verbose=true
# For ACS 4.15-17:
java -classpath /usr/share/cloudstack-common/lib/jasypt-1.9.3.jar org.jasypt.intf.cli.JasyptPBEStringDecryptionCLI decrypt.sh input=$input password=password verbose=true
import copy
a = 1
b = [1,2,3]
c = "Some random string :)"
z = [a,b,c]
x = list(z)
x[1][1] = 100
@rohityadavcloud
rohityadavcloud / my.cnf
Created July 27, 2015 10:19
Example MySQL my.cnf optimized
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
syslog
USE `cloud`;
INSERT into `cloud`.`vm_template` (unique_name, name, uuid, hvm, hypervisor_type) values ('systemvm-xenserver-4.5-fake-uuid', 'systemvm-xenserver-4.5', 'fakeduuidkvm1', 0, 'KVM');
INSERT into `cloud`.`vm_template` (unique_name, name, uuid, hvm, hypervisor_type) values ('systemvm-vmware-4.5-fake-uuid', 'systemvm-vmware-4.5', 'fakeduuidvmware1', 0, 'VMware');
@rohityadavcloud
rohityadavcloud / updateddns.sh
Created September 25, 2015 07:55
updateddns
#!/bin/bash
set -x
IP=$(wget -qO- http://ipecho.net/plain; echo)
wget -qO- http://username:[email protected]/nic/update?hostname=fqdn.host.name&myip=$IP &> /dev/null
@rohityadavcloud
rohityadavcloud / ListCiphers.java
Last active October 16, 2015 17:12
Lists available ciphers in jdk
import java.security.KeyStore;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.TrustManagerFactory;
public class ListCiphers
{
public static void main(String[] args)
@rohityadavcloud
rohityadavcloud / Crack2.java
Created November 1, 2015 09:53
CloudStack Encryption key retriever
import java.util.*;
import java.util.logging.*;
import java.io.*;
import java.lang.Math.*;
import java.nio.charset.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.BlockingQueue;
@rohityadavcloud
rohityadavcloud / updateddns
Created January 9, 2016 12:05
CloudFlare DDNS
[email protected]
cfkey=cf-key-here
zoneid=some-zoneid
dnsrec=dns-record-id
domain=somedomain.com
curl -X PUT "https://api.cloudflare.com/client/v4/zones/$zoneid/dns_records/$dnsrec" \
-H "X-Auth-Email: $cfuser" \
-H "X-Auth-Key: $cfkey" \
-H "Content-Type: application/json" \
@rohityadavcloud
rohityadavcloud / test-diff
Created March 5, 2016 11:07
Nux - vms on dashboard
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 22f7409..e91b349 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -4479,6 +4479,7 @@ textarea {
height: 316px;
overflow: auto;
overflow-x: hidden;
+ overflow-y: auto;
/*+placement:shift 0px 0px;*/
@rohityadavcloud
rohityadavcloud / create-rolemaps.py
Last active March 22, 2016 14:10
Dynamic role-based API checker for CloudStack - Migration from old commands.properties file
#!/bin/env python
# Usage: python <script> <commands.properties file>
import sys
import uuid
def createMappings(apis):
# All apis allowed for root Admin
print("INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`) values (UUID(), 1, '*', 'Allow')")
# ResourceAdmin, DomainAdmin, User
roles = [2, 3, 4]