Skip to content

Instantly share code, notes, and snippets.

View mahdiazarm's full-sized avatar

mahdi azarm mahdiazarm

  • us
View GitHub Profile
@mozhu1024
mozhu1024 / php_images_webshell_jpg.php
Created September 27, 2018 13:39
[PHP Image Webshell] A script to generate php webshell in image #php #image #img #webshell
<?php
/*
The algorithm of injecting the payload into the JPG image, which will keep unchanged after transformations
caused by PHP functions imagecopyresized() and imagecopyresampled().
It is necessary that the size and quality of the initial image are the same as those of the processed
image.
1) Upload an arbitrary image via secured files upload script
2) Save the processed image and launch:
@Haehnchen
Haehnchen / decrypt.java
Created May 14, 2017 15:43
PHP encrypt and JAVA decrypt with openssl and AES-128-CBC
public static String decrypt(@NotNull String input, @NotNull String key){
byte[] bytes = Base64.decodeBase64(input);
if(bytes.length < 17) {
return null;
}
byte[] ivBytes = Arrays.copyOfRange(bytes, 0, 16);
byte[] contentBytes = Arrays.copyOfRange(bytes, 16, bytes.length);
//Java
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("<your html file>"); //not in scope of this gist
webview.setWebViewClient(new WebViewClient(){
public void onPageFinished(WebView view, String url){
//Here you want to use .loadUrl again
//on the webview object and pass in
//"javascript:<your javaScript function"
webview.loadUrl("javascript:myJavaScriptFunc('" + argumentPassingIn + "')"); //if passing in an object. Mapping may need to take place
}
@pamobo0609
pamobo0609 / FileChooserActivity.java
Created November 1, 2016 15:28
Code capable of opening a file chooser from a Webview in Android
public class AgregarItemActivity extends AppCompatActivity {
Usuario user;
boolean listenerStatus;
String sessionID;
String eventoID;
String agregarItemURL;
String agregarImagenesURL;
String item;
@tripflex
tripflex / functions.php
Last active May 4, 2022 14:07
Automatically set/assign parent taxonomy terms for hierarchical taxonomies in WordPress (job listings, with job_listing_category taxonomy)
<?php
add_action( 'set_object_terms', 'auto_set_parent_terms', 9999, 6 );
/**
* Automatically set/assign parent taxonomy terms to posts
*
* This function will automatically set parent taxonomy terms whenever terms are set on a post,
* with the option to configure specific post types, and/or taxonomies.
*
*
* @param int $object_id Object ID.
@bennylope
bennylope / ffmpeg-watermark.md
Created April 22, 2016 23:17 — forked from webkader/ffmpeg-watermark.md
FFmpeg add a watermark to video

How to Add a Watermark to Video

FFMPEG filters provide a powerful way to programmatically enhance or alter videos, and it’s fairly simple to add a watermark to a video using the overlay filter. The easiest way to install ffmpeg is to download a pre-built binary for your specific platform. Then you don’t have to worry about including and installing all the right dependencies and codecs you will be using.

Once you have ffmpeg installed, adding a watermark is as easy as passing your existing source through an overlay filter like so:

ffmpeg -i test.mp4 -i watermark.png -filter_complex "overlay=10:10" test1.mp4

Basically, we’re passing in the original video, and an overlay image as inputs, then passing it through the filter, and saving the output as test1.mp4.

@mohsin
mohsin / StringUtils.java
Last active April 11, 2021 13:40
Function to convert Android menu.xml into string array for use in ArrayAdapter for NavigationDrawer
import android.view.Menu;
import android.view.MenuInflater;
import android.content.Context;
import android.support.v7.view.menu.MenuBuilder;
public class StringUtils {
/*
* Usage: String[] mMenuItems = StringUtils.getArrayFromMenu(this, R.menu.menu_main);
* And then mDrawerList.setAdapter(new ArrayAdapter<>(this, R.layout.item_listview_drawer, mMenuItems));
@cferdinandi
cferdinandi / has-characters.php
Last active January 7, 2024 11:58
Test strings for letters, numbers, and special characters. Returns true if they exist, false if they don't. Forked from http://stackoverflow.com/a/9588010/1293256
<?php
// Does string contain letters?
function _s_has_letters( $string ) {
return preg_match( '/[a-zA-Z]/', $string );
}
// Does string contain numbers?
function _s_has_numbers( $string ) {
return preg_match( '/\d/', $string );
@lancejpollard
lancejpollard / meta-tags.md
Created March 5, 2012 13:54
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@tracend
tracend / stop_sql_injection.php
Created April 20, 2011 22:22
PHP: Prevent SQL Injection
$sql = safeInput("UPDATE table_name SET field_one='%s', field_two='%s' WHERE id='%s'", $input);
function safeInput($string, $args){
foreach( $input as $key => $value ){
// 'clean' the input
$args[$key] = mysql_real_escape_string($value);
}
// add the statement as the first element of the array
$args[0] = $string;