Skip to content

Instantly share code, notes, and snippets.

View iomarmochtar's full-sized avatar
:octocat:
"Use the source luke"

Omar Mochtar iomarmochtar

:octocat:
"Use the source luke"
View GitHub Profile
@iomarmochtar
iomarmochtar / example_get_task.py
Last active November 18, 2017 12:43
Example of fetching Zimbra task and task list (recursive).
__author__ = ('Imam Omar Mochtar', 'iomarmochtar@gmail.com')
from ozpy.mailbox import Mailbox
import sys
from pprint import pprint
import os
"""
Example of fetching Zimbra task and task list (recursively).
"""
@iomarmochtar
iomarmochtar / install_pgadmin4.sh
Created August 24, 2017 02:22
Script for automating pgAdmin4 installation
#!/bin/bash
# Author: Imam Omar Mochtar (iomarmochtar@gmail.com)
# Desc : Script for automating pgAdmin4 as Desktop mode, make sure postgresql-dev and python-dev package has been installed
# , was tested in Ubuntu 16.04 LTS
BASE_DIR="/opt/pgadmin4"
RUN_SCRIPT="$BASE_DIR/run.sh"
VIRTENV="/usr/local/bin/virtualenv"
@iomarmochtar
iomarmochtar / AjxReloader.php
Created August 30, 2017 07:39
Helper untuk ajaxreloader pada yii2, utilizing ajax-crud
<?php
/**
* Author: Imam Omar Mochtar <iomarmochtar@gmail.com>
* Date: 08/04/17
* Reuse ajax-curd untuk menambahkan data secara async pada (sementara ini) komponen select. reload via pjax
*/
namespace common\utils;
use yii\web\AssetBundle;
@iomarmochtar
iomarmochtar / audit_watch.py
Created March 19, 2018 04:52
Parse zimbra audit file for blocking any massive failed authentication which indicating brute force attempt. if it's found then will do block mechanism and report to admin
#!/usr/bin/env python
__author__ = 'Imam Omar Mochtar <iomarmochtar@gmail.com>'
"""
Parse zimbra audit file for blocking any massive failed authentication which indicating brute force attempt
this script assume zimbra proxy and mailbox service in same server with original ip (oip) is logged
the attempted IP will listed in AUDITWATCH chain. for applying block combine run this command for add it in INPUT filter
@iomarmochtar
iomarmochtar / audit_watch.py
Created May 23, 2018 09:36
Simple script to parse zimbra's audit.log for failed authentication then it will report and block the IP, yes it's a simple alternative to fail2ban
#!/usr/bin/env python
__author__ = 'Imam Omar Mochtar <iomarmochtar@gmail.com>'
"""
this script assume zimbra smtp and mailbox service in same server with original ip (oip) is logged
the attempted/blocked IP will listed in AUDITWATCH chain. for applying block to it add rule in INPUT filter.
Example:
# iptables -t filter -I INPUT -j AUDITWATCH
"""
@iomarmochtar
iomarmochtar / listAllCosWithMembers.py
Created September 22, 2018 15:06
Get all COS (Class Of Service) including user assigned to it. #zimbra
#!/opt/zimbra/bin/zmpython
__author__ = ('Imam Omar Mochtar', ('iomarmochtar@gmail.com', 'imam.omar@jabetto.com'))
"""
Get all COS including user assigned to it. you may run this script inside zimbra's server (LDAP server is recommended)
"""
from com.zimbra.cs.account import Provisioning
@iomarmochtar
iomarmochtar / gfonts_offline.py
Created January 15, 2019 02:49
Python script to download google fonts
__author__ = ('Imam Omar Mochtar', 'iomarmochtar@gmail.com')
import urllib2
import sys
import os
import re
FONTS_DIR = 'fonts'
CSS_FILE = 'offline.css'
site = sys.argv[1]
@iomarmochtar
iomarmochtar / zimbra_after_xxe.txt
Last active April 13, 2019 10:37
My Zimbra Got Hacked by XXE bug What Should I do ?
Note:
- i suggest you for not delete any script or program that intruder put into your server, you can backup it and see how it's works.
so you can learn how it operated and can determine impact in your server.
- before or in parallel you do backup please make sure that your server is clean first by any backdoor !!!.
- you may considering reinstall your OS if the damaged from intruder was quite heavy,
eg: they are replacing some coreutils or some crucial daemon (SSH for instance).
in general you may see by detail any folder that zimbra user has write access to it.
but these are the common way you may check:
@iomarmochtar
iomarmochtar / simpletag.py
Created July 4, 2019 07:18
a python library to generating xml tag
__author__ = ('Imam Omar Mochar', ('iomarmochtar@gmail.com',))
"""
Simple XML builder, i create it for generating HTML tag(s)
"""
# alternative of xml attribute that also become keyword in python side
ALTERNATE_MAP = {
'klass': 'class'
}
@iomarmochtar
iomarmochtar / dark_ozpy.py
Created July 17, 2019 03:24
Utilizing ozpy for doing SSRF
__author__ = 'Imam Omar Mochtar (iomarmochtar@gmail.com)'
"""
WARNING : For learning purpose only !!!
This is example of utilizing ozpy for gaining zimbra admin rights through SSRF vulnerability
"""
import sys
import requests