It is currently Sat Dec 14, 2019 12:18 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 105 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Oct 05, 2016 6:22 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated:
- renamed 1 example
-- Stuff\AESEncryption\EncryptDecrypt.pb to Stuff\AESEncryption\AES_EncoderDecoder.pb
- added 2 examples
-- Stuff\AESEncryption\AES_CipherBuffer.pb
-- Stuff\OtherStuff\PlotCurve.pb: based on an equation found here

Plot Curve Function:
- used in PureBasic Interface to OpenCV to enhance the morphing examples

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Oct 18, 2016 11:27 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated:
- added 3 examples
-- Stuff\MemoryFolder\MemoryFolder.pb
-- Stuff\OtherStuff\CompressUncompress.pb
-- Stuff\OtherStuff\GetFolderSize.pb

Currently LSB (Least Significant Bit) File Embedding doesn't support embedding folders. While it does allow for embedding zipped folders, I wanted a way to compress a folder in memory without first writing to disk or requiring user-interaction.

MemoryFolder.pb:
- write a folder, subfolders, and files to memory
- compress the memory
- uncompress the memory
- recreate the folder, subfolders, and files to a specified location

The following options can be configured to suit requirements.
- Iterate Subfolders: empty folders are ignored
- Max Folder Size: 150MB or less
- Root Folder: folder path, new folder name, folder path \ new folder name
Code:
IterateSubfolders   = #True
MaxFolderSize.q     = 104857600
RootFolder.s        = "MemoryFolder"

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Thu Oct 20, 2016 8:24 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Fri Oct 21, 2016 3:58 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated:
- added 2 examples
-- Stuff\iPhoneIV\iPhoneIV.pb
-- Stuff\WebSnapshot\WebSnapshot.pb

iPhoneIV.pb (iPhone Image Viewer)
- press the iPhone Home button to slide between images
- press the Esc key to close the window

WebSnapshot.pb
- save a snapshot of a webpage regardless of scroll area

Based on script found here by Kiffi.
- fixed a bug in the original code not correctly calculating height with some webpages (e.g. https://en.wikipedia.org/wiki/PureBasic)

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Oct 25, 2016 8:33 am, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Fri Oct 21, 2016 7:55 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated Stuff\iPhoneIV\iPhoneIV.pb (iPhone Image Viewer)
- renamed the example Stuff\PNGWindow\PNGWindow.pb to Stuff\PhoneIV\PhoneIV.pb
- fixed a bug with the iPhone Home button

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Tue Oct 25, 2016 1:24 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Mon Oct 24, 2016 8:30 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated:
- added 1 example
-- Stuff\InflateDeflate\InflateDefalte.pb

This example creates a gzip (*.gz) compressed file to the current folder, and an uncompressed version of the original file.
- the windowBits parameter determines the format: see zlib Manual
Quote:
-- 8..15 = zlib format
-- 24..31 = gzip format
-- -8..-15 = raw zlib format with no header

NB*: Originally used in PureBasic Interface to WinDivert to compress and decompress webpages; updated to work with any file.

------------------------------------------------------------------------------

Updated:
- OSX compatible
- added additional OS Constants: GZIP file format specification version 4.3
- added header Procedures
- fixed a bug that caused the header filename to display incorrectly

NB*: Enable Debug to view header data.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Oct 25, 2016 1:16 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated Stuff\iPhoneIV\iPhoneIV.pb (iPhone Image Viewer)
- added the option to toggle between Portrait and Landscape
-- press the Spacebar to switch orientation
- added image scaling on resize
- added a couple sound effects

Image

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Jan 10, 2017 8:06 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Updated the first post:
- added individual download links to all parts of the package

NB*: Some of the download links contain executables (source code included), and may be flagged by your AV software.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Tue Jan 10, 2017 10:34 pm 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
Thank you very much it's wonderfull!!

i'm using a batch script for starting and stopping services:


Code:
stop
sc config dhcp start= disabled
net stop dhcp /y
start
sc config dhcp start= auto
net start dhcp /y


it seems your code is only doing the first line, sc, how can i do also the second line, net?


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 1:38 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Hi boyos,

The following is from the first post... or is there something else you need help with?

Services:
- WindowsServices.pbi (ServiceStatusEnum, ServiceCreate, ServiceDelete, ServiceStatus, ServiceStartup, ServiceStart, ServiceStop)
- TestService.pb: example to create a service
- binaries\
-- TestJHP_EXE.pb : TestJHP.exe
--- example program run as a service
-- TestJHPService_EXE.pb : TestJHPService.exe
--- example service used to execute: TestJHP.exe
Quote:
This window / executable is being run from a service.

If the window is closed, it will reopen within 10 seconds.

The service is being executed using the current user's credentials.

Run the file: TestService.pb a second time to delete the service.

The following is a list of services created using the ServiceStatusEnum Procedure.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Wed Jan 11, 2017 4:40 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 1:42 am 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
Yes, i need help to run the net command ftom purebasic.
Thank you very much


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 4:47 am 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Hi boyos,

I'm assuming you mean the START and STOP parameters of the NET command used for a service :?:
- if so the equivalent Procedures are located in the file WindowsServices.pbi (recently updated)
Quote:
The syntax of this command is:
NET
[ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | PAUSE | SESSION | SHARE | START |
STATISTICS | STOP | TIME | USE | USER | VIEW ]

I've also updated the SERVICES section of the package to include an additional example.
- StartStopService.pb: example to stop then start a service

NB*: Some filenames have been changed.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 2:18 pm 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
i'm sorry i didn't understand
you mean you have a function NetStop(service.s)?
i don't see it??


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 3:31 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Hi boyos,

If you haven't already done so, download the updated SERVICES section of the package.

The two files you will need to review:
- StartStopService.pb: example script-file testing three of the Procedures from WindowsServices.pbi
-- ServiceStatus, ServiceStop, ServiceStart
- WindowsServices.pbi: include-file hosting Structures, and Procedures interfacing Windows (service) API's

Run the file StartStopService.pb for a working example on starting and stopping a service, but notice the main body of work is from the Include file WindowsServices.pbi.

NB*: In order to interface Windows API's, a licenced version of PureBasic is required, the demo version excludes this feature.

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Last edited by JHPJHP on Thu Jan 12, 2017 10:22 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 10:27 pm 
Offline
User
User

Joined: Fri Feb 05, 2016 10:11 am
Posts: 73
i'm sorry, but i think i need also the "net" command, because when i stop the services, they restart automaticly.

Code:
IncludeFile "plus\WindowsServices.pbi"
services.s = "dhcp dnscache netman netprofm nsi webclient wlansvc rasauto rasman IKEEXT sstpsvc wcmsvc"

Procedure yhe_service(services.s, mode.l)
   Define.l i, result
   Define.s service, success, not_success
   
   
   
   For i = 1 To CountString(services, " ") + 1
      service = StringField(services, i, " ")
      Select mode
         Case 0
            If ServiceStop(service) : success + service + " " : Else : not_success + service + " " : EndIf
         Case 1
            If ServiceStart(service) : success + service + " " : Else : not_success + service + " " : EndIf
         Case 2
            Select ServiceStatus(service)
               Case "The service is running." : success + service + " "
               Case "The service is stopped." : not_success + service + " "
            EndSelect
      EndSelect
   Next
   
   Debug "OK: " + success
   Debug "ERROR: " + not_success
EndProcedure

yhe_service(services, 0); stop
;yhe_service(services, 1); start
yhe_service(services, 2); check



thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Services, Stuff, and Shellhook
PostPosted: Wed Jan 11, 2017 11:14 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Oct 09, 2010 3:47 am
Posts: 1597
Hi boyoss,

Try the following:
- make sure to set Request Administrator mode for Windows Vista and above from Compiler Options

NOTE: Services such as DHCP have dependencies services, and may need a greater timeout then the current 60 seconds to report the status accurately
- you can try running the script a second time to see if the service is "stop pending"
- some services may have a timed-restart or cannot be stopped
Code:
IncludeFile "WindowsServices.pbi"

Procedure set_service(services.s, mode)
  Define.s service, status

  Debug "STARTED" + #LF$

  For i = 1 To CountString(services, " ") + 1
    service = StringField(services, i, " ")
    status = ServiceStatus(service)
    nTimeOut = ElapsedMilliseconds()

    Select mode
      Case 0
        If status = "The service is running."
          Debug service + " [ STOP ] working..."
          ServiceStop(service)

          Repeat
            Delay(100) : status = ServiceStatus(service)
          Until status <> "The service is running." Or ElapsedMilliseconds() - nTimeOut > 60000
          Debug service + ": " + ServiceStatus(service) + #LF$
        Else
          Debug service + ": The service is not running (" + status + ")" + #LF$
        EndIf
      Case 1
        If status = "The service is stopped."
          Debug service + " [ START ] working..."
          ServiceStart(service)

          Repeat
            Delay(100) : status = ServiceStatus(service)
          Until status = "The service is running." Or ElapsedMilliseconds() - nTimeOut > 60000
          Debug service + ": " + ServiceStatus(service) + #LF$
        Else
          Debug service + ": The service is not stopped (" + status + ")" + #LF$
        EndIf
    EndSelect
  Next
  Debug "COMPLETED"
EndProcedure

services.s = "dhcp dnscache netman netprofm nsi webclient wlansvc rasauto rasman IKEEXT sstpsvc wcmsvc"
set_service(services, 0)

_________________

I will be unreachable from the forum for an indefinite period; downloads moved to My PureBasic Stuff.
_________________


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 105 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye