Windows Services & Other Stuff

Developed or developing a new product in PureBasic? Tell the world about it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi marroh,

Thank you for your comments, they're appreciated.

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

Removed two examples:
- TurnPage.pb
- MagnifyingGlass.pb

Added another two examples to the Stuff folder:
- WindowStuff/DisplayStuff
-- Orientation.pb
-- Rotation.pb

DisplayStuff
- Orientation.pb: locks the display orientation on a tablet for the current process
- Rotation.pb: rotates the display to a set orientation
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Services, Stuff, and Shellhook

Post by yrreti »

JHPJHP

You've put some good stuff on the forum. Thank you!

Could you possibly check that someone hasn't tampered with your Services_Stuff_Shellhook.zip file?
After my antivirus flagged it. I disabled it and downloaded it anyway. Then I sent it to VirusTotal free online,
https://www.virustotal.com
in which 13 out of 57 indicated virus infected.

Thanks
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi yrreti,

I've downloaded the ZIP file from the forum and went through the examples, I'm confident nothing has been tampered with.

Some of the examples have been compiled, possibly the reason for the false positives, but the source code is included.
- I precompiled the code for instruction purposes only

Personally I would compile the source code again, replacing existing executables when dealing with downloads from a forum.

Thank you for posting your concerns, I'm security concise myself.
yrreti
Enthusiast
Enthusiast
Posts: 546
Joined: Tue Oct 31, 2006 4:34 am

Re: Services, Stuff, and Shellhook

Post by yrreti »

Hi JHPJHP
Thanks for re checking it out.
One can never be too careful now days.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

You're welcome yrreti.

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

Added another example to the Stuff folder:
- MoreStuff/SetCriticalFlag.pb

If the script is executed with the current settings:
- warns you that the BSOD may occur if you proceed
- notifies you that the critical flag is present
- notifies you that the critical flag is not present
-- this will avoid the BSOD as the process is no longer marked as critical

Code: Select all

SetCriticalFlag(#Null, #True)
SetCriticalFlag(#Null, #False)
If the first parameter is #Null the script uses the current process, otherwise it expects a PID (process ID).

Second parameter options: #True, #False or Excluded (-1).
- #True: sets the critical flag
- #False: removes the critical flag
- Excluded (-1): checks if the critical flag is present

NB*: With the current settings, removing the second call to the Procedure: SetCriticalFlag will cause the BSOD to occur when the process ends.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added another bunch of examples to the Stuff folder:
- MoreStuff/ConnectUNC.pb
- MoreStuff/FTP/TestFTP.pb
- MoreStuff/GetProductKey.pb
- MoreStuff/MapDrive.pb
- GadgetStuff/ListIconGadget/MultiLine_Image.pb (includes image: shape.ico)

NB*: Applied numerous bug fixes to various examples; includes an update to the "Window Watcher" (shellhook) application, now supporting Windows 10.
Last edited by JHPJHP on Tue Oct 06, 2015 1:46 pm, edited 1 time in total.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Added a new example and updated a couple others from the Stuff folder.
- GadgetStuff/WebGadget/Binaries/baboon.jpg, ball.mp4
- GadgetStuff/WebGadget/ImageSize.pb, VideoInfo.pb
- GadgetStuff/WebGadget/NoScroll.pb

VideoInfo.pb:
- registry is temporarily modified to access HTML5: FEATURE_BROWSER_EMULATION
- supported video formats: http://www.w3schools.com/tags/tag_video.asp
- supported properties: https://msdn.microsoft.com/en-us/librar ... 67398.aspx

NB*: Added an "Event Listener" to the VideoInfo.pb example, fixing an issue that occurred when an unsupported file got past the filter.
Last edited by JHPJHP on Tue Oct 13, 2015 7:54 pm, edited 2 times in total.
said
Enthusiast
Enthusiast
Posts: 342
Joined: Thu Apr 14, 2011 6:07 pm

Re: Services, Stuff, and Shellhook

Post by said »

Thanks a lot for sharing your little jewels :D :D
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi said,

Thank you for your kind words.

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

Moved the VideoPlayer.pb example and associated binaries to: Embed JS Framework into PureBasic.

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

Updated:
- added 2 examples
-- Stuff\MoreStuff\CPU\GetUsage.pb, GetUsage.ico
-- Stuff\MoreStuff\Download\Download.pb, Download.ico, Download.vbs

GetUsage.pb
- measure CPU usage
- http://www.vbforfree.com/calculate-and- ... tem-usage/

This example was originally written to feed data to the example Flot_RealTime.pb in Embed JS Framework into PureBasic, but the end result didn't work as expected.

Download.pb
- auto-login / download 32bit version of PureBasic (requires authentication)
- http://www.development-lounge.de/viewto ... 6&start=12

Writing this example I assumed it would be similar to using MSXML2.XMLHTTP in VBScript, but my first attempts failed. It wasn't until I found the script by amiga that I realized passing the cookie between sessions and location adjustments were required.

Building URLs is made easier with Fiddler.
- at each authentication step / data required to proceed, record a session revealing the true URL (see Inspectors : Raw tab)

I'm sure many of you have written the VBScript method to download files, but PureBasic (without COMatePLUS) is very different.
- download the package to see a PureBasic version

Code: Select all

Const adTypeBinary = 1
Const adSaveCreateOverWrite = 2

Set objHTTP = CreateObject("MSXML2.XMLHTTP")
objHTTP.Open "POST", "http://www.purebasic.com/securedownload/DoLogin.php", False
objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
objHTTP.setRequestHeader "Connection", "close"
objHTTP.Send "language=&Login=xxxxxxxx&Password=yyyyyyyy"
objHTTP.Open "GET", "http://www.purebasic.com/securedownload/Transfert.php?Filename=Windows_x86&Version=5_40&LTS=_LTS", False
objHTTP.Send

If objHTTP.Status = 200 Then
	Set objADOStream = CreateObject("ADODB.Stream")
	objADOStream.Open
	objADOStream.Type = adTypeBinary
	objADOStream.Write objHTTP.ResponseBody
	objADOStream.Position = 0
	objADOStream.SaveToFile "Windows_x86_Version_5_40_LTS.exe", adSaveCreateOverWrite
	objADOStream.Close
	Set objADOStream = Nothing
End If
Set objHTTP = Nothing
Last edited by JHPJHP on Tue Nov 03, 2015 7:11 am, edited 3 times in total.
Hadrianus
User
User
Posts: 34
Joined: Wed Mar 27, 2013 11:31 pm

Re: Services, Stuff, and Shellhook

Post by Hadrianus »

Hi JHPJHP,

I love your JS-magic for Purebasic. Please take a look at ViewerJS.org, it's a fully independent PDF-viewer and free to use. I tried to connect this with PB. Perhaps you will bring this viewer to PB one day.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Thank you Hadrianus.
- see: http://www.purebasic.fr/english/viewtop ... 49#p475149

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

Updated:
- added 1 example
-- Stuff\WindowStuff\GadgetBar\GadgetBar.pb

NB*: Click the window to reveal the "Sliding Gadget-Bar", click it again to hide it.
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Updated and reorganized some of the examples to be more intuitive.
- Stuff\MoreStuff\AWS\AWS.pb has been updated to support both ASCII and Unicode (PureBasic 5.40 LTS)

Amazon Web Services (AWS) - Get Book Information
Last edited by JHPJHP on Sat Sep 24, 2016 9:49 pm, edited 1 time in total.
marroh
User
User
Posts: 72
Joined: Wed Aug 06, 2008 8:21 am

Re: Services, Stuff, and Shellhook

Post by marroh »

Thx for update! :mrgreen:
PureBASIC v5.41 LTS , Windows v8.1 x64
Forget UNICODE - Keep it BASIC !
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Hi marroh,

You're welcome, and thank you for commenting.

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

Updated:
- renamed, reorganized, and improved many of the "Stuff" examples
- added 3 examples
-- Stuff\EncryptDecrypt\EncryptDecrypt.pb
-- Stuff\OtherStuff\FormatDevice.pb
-- Stuff\ProtocolStuff\Telnet.pb

EncryptDecrypt.pb: Supports both Ascii and Unicode (modified from a larger project).
- in order to enable Decrypt enter JHPJHP in the text-box than press the Clear button

FormatDevice.pb: Format Tracks and File System of various devices.

Telnet.pb
Awhile back I had a contract to write an application where a small part was connecting to a Telnet server to initiate a pre-written recall. Seemingly straight forward I wrote a script using the following documentation, but it kept failing.
- http://www.cs.cf.ac.uk/Dave/Internet/node141.html ("Option Responses" reversed)

It wasn't until I found this script by Xombie that I realized the documentation from the site I was using had the "Option Responses" reversed.

With the script provided by Xombie and the information from the following site I was able to fix the problem.
- http://www.pcmicro.com/netfoss/telnet.html

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

Updated the examples to be Unicode compliant (enabled by default).
JHPJHP
Addict
Addict
Posts: 2129
Joined: Sat Oct 09, 2010 3:47 am
Contact:

Re: Services, Stuff, and Shellhook

Post by JHPJHP »

Updated:
- added 1 example: Cross-Platform Digital Clock
-- Stuff\DigitalClock\DigitalClock.pb

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

Updated DigitalClock.pb:
- switch from an ImageGadget to a CanvasGadget
- removed the Titlebar
- added a Context Menu

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

Updated DigitalClock.pb:
- added transparency (Windows only)
- updated Context Menu
-- Transparent Window
-- Background Color
-- Set Time Format
--- 12 Hour Time
--- 24 Hour Time
-- Exit Digital Clock

Default Settings:

Code: Select all

#CLOCK_SIZE_SMALL         = 0.5
#CLOCK_SIZE_ORIGINAL      = 1
#CLOCK_SIZE_LARGE         = 2

#TIME_FORMAT_12           = 0
#TIME_FORMAT_24           = 1

CLOCK_SIZE.d              = #CLOCK_SIZE_ORIGINAL
BACKGROUND_COLOR          = RGB(0, 0, 0)
TRANSPARENT_WINDOW        = #True
TIME_FORMAT               = #TIME_FORMAT_12
Locked