Skip to content

Instantly share code, notes, and snippets.

View Mehran's full-sized avatar
🎯
Focusing

Mehran Mehran

🎯
Focusing
View GitHub Profile
Get-ADUser -Filter {(Enabled -eq "True") -and (PasswordNeverExpires -eq "True")} -Properties SamAccountName, PasswordNeverExpires | ft Name, SamAccountName, PasswordNeverExpires
Get-ADUser -Filter {(Enabled -eq "True") -and (PasswordNeverExpires -eq "False")} -Properties SamAccountName, PasswordLastSet | Where PasswordLastSet -le (Get-Date).AddDays(-30) | ft Name, SamAccountName, PasswordLastSet
Get-ADUser -Filter {(Enabled -eq "True") -and (PasswordNeverExpires -eq "False")} -Properties SamAccountName, LastLogon | Where-Object {([datetime]::FromFileTime($_.LastLogon) -le (Get-Date).AddDays(-90))} |ft Name, SamAccountName, {[datetime]::FromFileTime($_.LastLogon)}
Get-ADGroupMember 'domain admins' | select name,samaccountname
Get-ADGroupMember 'enterprise admins' | select name,samaccountname
Get-LocalGroupMember "admins local fhbf"
@Mehran
Mehran / gist:d3541a4af0bd7f9226bcaf1072c2adb4
Created February 15, 2021 05:35
Install owncloud Ubuntu 20.04
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release :2021-02-15
# Description : Install owncloud on ubuntu 20.04
# Version : 1.0
###############
db_name="owncloud"
db_username="ownclouduser"
# Package generated configuration file
# See the sshd_config(5) manpage for details
# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
@Mehran
Mehran / insta_backup.sh
Last active January 9, 2019 05:42
Instapy Backup
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release : 2019-01-06
# Description : InstaPy Backup
# Version : 1.1
###############
if [ ! -d /root/backup ]; then
mkdir -p /root/backup;
@Mehran
Mehran / uploader.sh
Created December 4, 2018 10:19
Upload files to Dropbox
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release : 2018-12-04
# Description : File Download then Upload to Dropbox
# Version : 1.2
###############
path_to_upload() {
default_up_path="/Education"
read -p $"Enter Path to upload (Enter to default): " up_path
@Mehran
Mehran / wireguard.sh
Last active June 16, 2023 11:53
WireGuard setup Server Side
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release : 2018-10-24
# Update : 2018-12-22
# Description : WireGuard Automation - Server Side
# Version : 1.3
###############
### Color's ###
@Mehran
Mehran / git-update.sh
Last active August 9, 2018 06:20
Automatic Gist update
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release : 2018-04-07
# Description : Git auto update for repository
# Version : 1.2
###############
### Colors ####
@Mehran
Mehran / ikev2.sh
Created July 14, 2018 04:51
IKEV2 Automation
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Release : 2018-06-24
# Description : IKEV2 Auto Creator
# Version : 1.1
###############
### Colors ####
BRed="\033[1;31m"
BGreen="\033[1;32m"
@Mehran
Mehran / instapy-easy.sh
Last active December 18, 2018 13:54
instapy-easy.sh
#!/bin/bash
### Author ###
# By : Mehran Goudarzi
# Update : 2018-11-12
# Description : Automation Installer (Ubuntu 18.0 & Ubuntu 16.0)
# Version : 1.2
###############
echo -e "[*] General dependencies..."
apt-get update
apt-get -y upgrade
@Mehran
Mehran / resizeme.sh
Last active May 13, 2018 04:55
Automation script to resize Diskspace for Kali Linux 2018.2 in RaspberryPi 3
#!/bin/sh
# Automation resize remaining diskspace for Kali Linux 2018.2 on Rapsberry Pi3
# Get the starting offset of the root partition
PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^2" | cut -f 2 -d:)
[ "$PART_START" ] || return 1
# Return value will likely be error for fdisk as it fails to reload the
# partition table because the root fs is mounted
fdisk -uc /dev/mmcblk0 <<EOF