Showing posts with label using. Show all posts
Showing posts with label using. Show all posts

Friday, July 21, 2017

Deleting a remote branch using command line Git

Deleting a remote branch using command line Git


If you are familiar with GitHub UI after browsing branches tab you can simply delete a branch(If you have relevant permissions).


Lets see how we do the same using command line.
git push <REMOTE_NAME> :<BRANCH_NAME>
Note the space between remote name and the colon. By following this syntax you are asking git to push nothing hence git push will delete the branch in remote repository.

Eg:-
udara@udara-home:~/workspace/h2-social-adaptor$ git push origin :v2
To git@github.com:udarakr/h2-social-adaptor.git
 - [deleted]         v2

Read more »

Tuesday, June 13, 2017

Deliver powershell payload using macro

Deliver powershell payload using macro


In past we saw method of direct shell code execution in Ms word or Excel using macro;but if document is closed then we will lose our shell so we have to migrate to other process and sometimes migration is pick up by AV. So in this tutorial we are going to use powershell payload.

Advantages of this method:-


(1)Persistence
(2)Migration is not needed
(3)AV bypass

(1)First we will generate powershell payload; for this purpose i used SET.You can also used Veil or powersploit.Open SET in terminal & select Social-Engineering Attacks and then Powershell Attack Vectors.Generate Powershell Alphanumeric Shellcode Injector.Fill LHOST & LPORT value.

SET-powershell-payload

Our generated powershell payload is located into /root/.set/reports/powershell/. Rename x86_powershell_injection.txt to x32.ps1.

(2)Now Clone git repository of code

root@bt:~# git clone https://github.com/enigma0x3/Old-Powershell-payload-Excel-Delivery
root@bt:~# cd Powershell-payload-Excel-Delivery/

(3)In Powershell-payload-Excel-Delivery folder; rename RemovePayload.bat to remove.bat. Now you have to host remove.bat and x32.ps1 to web-server.Then open persist.vbs file and change URL of x32.ps1 in line 13,33 to your hosted x32.ps1 `s URL. And now also host persist.vbs to web-server. I used localhost.

hosted-payload

(4)Open Macrocode file from cloned folder & change URL in line 27,82,118 respectively to your hosted x32.ps1,persist.vbs and remove.bat `s URL.Now add this macro code into excel document as mentioned in previous tutorial.

(5)And last step is setup listener.

metasploit-listener

Now send this document to victim , as soon as he open document and run macro we will get shell. Once the payload is ran, it runs in the powershell process, so if the user closes excel, you keep your shell. You also remain in a stable process until reboot, so migration is not needed.

powershell-process

It then pulls down a persistence script, drops it, creates a registry key for autorun for the persistence script. Once done, it also drops a self-deleting bat file that removes the initial payload from the system.

persist using regestiry

Thanks to  enigma0x3 for this awesome method.

Update :- New-Powershell-Payload-Excel-Delivery

This is a VBA macro that uses Matt Graebers Invoke-Shellcode to execute a powershell payload in memory as well as schedule a task for persistence(20 min onidle  you get shell).
root@bt:~# git clone https://github.com/enigma0x3/Powershell-Payload-Excel-Delivery.git
root@bt:~# cd Powershell-Payload-Excel-Delivery/

Open MacroCode file & change Download URL for Invoke-Shellcode file & change LHOST & LPORT option. Now add macro-code in Excel file & start-up listener.
Read more »

Wednesday, May 10, 2017

DDA algorithm implementation using OpenGL in C

DDA algorithm implementation using OpenGL in C


#include<GL/glut.h>
#include<windows.h>
#include<stdlib.h>
#include<stdio.h>
GLint x0,y0,xEnd,yEnd;
inline GLint round(const GLfloat a)
{
    return GLint(a+0.5);
}
void myInit(void)
{
    glClearColor(0.0,1.0,1.0,0.0);
    glColor3f(1.0f,0.0f,0.0f);
    glPointSize(3.0);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    gluOrtho2D(0.0,640.0,0.0,480.0);
}
void readInput()
{

    printf("Enter x0, y0, xEnd, yEnd(resp): ");
    scanf("%i %i %i %i",&x0,&y0,&xEnd,&yEnd);

}
void setPixel(GLint xcoordinate, GLint ycoordinate)
{
    glBegin(GL_POINTS);
    glVertex2i(xcoordinate,ycoordinate);
    glEnd();
    glFlush();
}

void lineDDA(GLint x0,GLint y0,GLint xEnd,GLint yEnd)
{
    GLint dx = abs(xEnd-x0);
    GLint dy = abs(yEnd-y0);
    GLint steps,k;
    GLfloat xIncrement,yIncrement,x=x0,y=y0;

    if(dx>dy)
        steps = dx;
    else
        steps = dy;

    xIncrement = GLfloat(dx) / GLfloat(steps);
    yIncrement = GLfloat(dy) / GLfloat(steps);
    setPixel(round(x),round(y));

    for(k=1;k<steps;k++)
    {
        x+= xIncrement;
        y+= yIncrement;
        setPixel(round(x),round(y));
    }
}

void Display(void)
{
    glClear(GL_COLOR_BUFFER_BIT);
    lineDDA(x0,y0,xEnd,yEnd);
}

int main(int argc,char *argv[])
{
    glutInit(&argc,argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    glutInitWindowSize(600,600);
    glutInitWindowPosition(50,50);
    glutCreateWindow("DDA Line Algorithum");
    readInput();
    glutDisplayFunc(Display);
    myInit();
    glutMainLoop();
    return EXIT_SUCCESS;
}
Read more »

Monday, April 24, 2017

Deploying applications or libraries to WebLogic Server using command line

Deploying applications or libraries to WebLogic Server using command line


Here is how you can automate deployment for WebLogic server using command line.

First source the env settings from the server:
$ source $ML_HOME/server/bin/setWLSEnv.sh

Deploy Library:
$ java weblogic.Deployer -nostage -deploy -library
-adminurl localhost:7001
-username weblogic -password my_secret
-targets myserver
my_shared_lib.war


Deploy Application:
$ java weblogic.Deployer -nostage -deploy
-adminurl localhost:7001
-username weblogic -password my_secret
-targets myserver
-name myapp.war myapp.war


For development, you likely want to use the "-nostage" meaning to deploy the app or library directly from the file system. This means any changes to that file location and a reload from WLS will take effect immediately.

For undeploy the command line options are same for library or app but with matching name.
$ java weblogic.Deployer -undeploy
-adminurl localhost:7001
-username weblogic -password my_secret
-targets myserver
-name myapp_or_lib.war
Read more »

Thursday, April 6, 2017

Debugging PHP in Quanta Using xdebug

Debugging PHP in Quanta Using xdebug


Quanta is a full featured KDE programming editor. Quanta now has support for DBGp debugging protocol. Install quanta by by issuing following command.

sudo apt-get -y install quanta

Configuring xdebug

Install xdebug using previous blog post on Debugging PHP using xdebug. After installing xdebug add following configuration options to your /etc/php5/apache2/php.ini.

xdebug.remote_enable = 1 xdebug.remote_handler = dbgp xdebug.remote_mode = req xdebug.remote_port = 9000 xdebug.remote_host = localhost

Now restart your apache using following command.

sudo /etc/init.d/apache2 restart

Configuring quanta

You can debug php scripts only in projects. Create a new project in quanta and add /var/www to it. Open project properties, select DBGp from Debugger combo box and accept remaining default settings. If you followed previous steps and debugging on local machine then you dont have to do anything else. If you have to change debug port and server url then click on Options button and change those settings.

By now you should have a debug menu and debug toolbar. If quanta is ready for debugging then all those debugging buttons on toolbar will be enabled by default. If not then start a new debug session from debug menu in menubar.

From now you can set breakpoints, watch variables and get call stack(backtrace) information during debug session.

Read more »