Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

Commit

Permalink
Start Building WebShell
Browse files Browse the repository at this point in the history
  • Loading branch information
Naville committed Mar 10, 2016
1 parent 976a10d commit 877a5f7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Hooks/Misc/Cycript.xm
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#import "../SharedDefine.pch"
#define Port 2588
extern void CYListenServer(short port);
extern void init_Cycript_hook() {
CYListenServer(Port);
NSLog(@"Cycript Server At %i",Port);
CYListenServer(CyPort);
NSLog(@"Cycript Server At %i",CyPort);
//Shall We Inform DeviceIP and Port Through GUI?
}
2 changes: 2 additions & 0 deletions Hooks/SharedDefine.pch
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,6 @@ static NSString *preferenceFilePath = @"/private/var/mobile/Library/Preferences/

#define RMASLRCenter @"com.naville.wtfjh.rmaslr"

#define CyPort 2588


17 changes: 17 additions & 0 deletions Hooks/Utils/WebShell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifdef PROTOTYPE
#import <Foundation/Foundation.h>
#import <spawn.h>
#import <termios.h>
#import <unistd.h>
#import <sys/ioctl.h>
@interface WebShell{
int subprocessPTY;
int fatherPTY;
pid_t processPID;
pid_t SSHPID;
}
-(instancetype)init;
@end


#endif
38 changes: 38 additions & 0 deletions Hooks/Utils/WebShell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifdef PROTOTYPE
#import "WebShell.h"
@implementation WebShell : NSObject
-(instancetype)init{
self=[super init];
self->fatherPTY = open("/dev/ptmx", O_RDWR | O_NOCTTY);
if(self->fatherPTY==-1){
NSLog(@"/dev/ptmx Handle Returned Error");
return nil;
}
grantpt(self->fatherPTY);
unlockpt(self->fatherPTY);



return self;
}
-(void)release{
close(self->subprocessPTY);
close(self->fatherPTY);
[super release];


}
-(void)startChild{
NSString* address=[[NSString stringWithFormat:@"127.0.0.1:%i",CyPort] autorelease];
//Viva La Objective-C

const char *arg1[] = { "/usr/bin/cycript", "-r", address.UTF8String, NULL };
const char *envp[] = { "TERM=xterm-256color", NULL };
execve(arg1[0],arg1,envp);

}


@end

#endif

0 comments on commit 877a5f7

Please sign in to comment.