Ephelyon Posted January 25, 2016 Posted January 25, 2016 Just reaching out to more experienced coders as programming has never been my strong point... We've known for a little while that students with access to Python are able to change their desktop background by means of code similar to the below: import ctypes SPI_SETDESKWALLPAPER = 20 ctypes.windll.user32.SystemParametersInfoA(SPI_SETDESKWALLPAPER, 0, "blahblah.jpg", 0) Most of it is fairly innocuous - Star Wars backgrounds etc. - but unfortunately this morning we've had the (inevitable) naked ladies. I'd imagine the image itself was brought in via USB stick or someone's personal online storage. SLT aren't happy that this is possible and my "reminders" that this is (just the start of) what NMs were kicking off about when programming became part of the mainstream curriculum seem to be falling on deaf ears. Nevertheless, does anyone know whether it's possible to disable certain Python modules or functions without any major side effects - ideally a deployable method? I've tried removing the Ctypes folder from Lib through GPP Folders, but unfortunately this causes an MSI re-install whenever Python is launched as it detects missing components, which it seems is an unacceptable delay. If it's possible to do it properly, I wouldn't mind getting rid of anything that reads to or writes from the Registry too (proxy settings etc)...
kennysarmy Posted January 25, 2016 Posted January 25, 2016 To be honest I'd bite the bullet and look at wrapping the "programming" software up in a sandbox environment, something like Oracle VM Virtualbox. Then the students can cause whatever mayhem they like in an environment that resets itself when they reboot. 1
synaesthesia Posted January 25, 2016 Posted January 25, 2016 As above, this is one of many things that students are able to do with Python installed directly onto the computers, and I would certainly recommend VM'ing it up for security reasons.
mavhc Posted January 25, 2016 Posted January 25, 2016 I assume there's a registry key you can remove permissions from
Ephelyon Posted January 27, 2016 Author Posted January 27, 2016 That would be an HKCU key so users have permission by default (and taking it away within a User hive can get problematic) - either way, that method uses a function call rather than direct Registry modification. Unfortunately VMs on workstations don't seem to be an option for us. Since my last post I've created and deployed a VM with VirtualBox, but running it inevitably causes the workstation to either hang up and reboot or give a STOP 0x00000101 error within a few minutes. Most of our suites where coding would be taught have old Dell OptiPlex 740s which, even with RAM, SSD and BIOS upgrades (no CPU config options), don't seem to be able to handle it... and we've no money for replacements en masse, of course. So put bluntly, then, are we saying there's no way to programmatically disable functionality within Python?
mavhc Posted January 27, 2016 Posted January 27, 2016 Not sure why teachers aren't happy that there's a trail of evidence as to who committed a banned action, much easier to trace than the owners/creators of physical items (drawing on walls, leaving banned objects around). Just ban the user for a week from computers etc etc
Ephelyon Posted January 27, 2016 Author Posted January 27, 2016 The problem is that this particular banned action is of the type that can have consequences beyond school discipline. Just as it's possible to sue your employer if another employee has pornography on their screen and you can see it from across the office (and are "offended" by it, of course), so it is in school classrooms. It's an incredibly unlikely outcome, but as I said, now that they can change the desktop background it's only a matter of time before the naked ladies begin to appear...
mavhc Posted January 28, 2016 Posted January 28, 2016 I think you'd only be required to have taken reasonable steps to avoid it. I'd ban usb sticks anyway, because they die all the time.
Ephelyon Posted January 28, 2016 Author Posted January 28, 2016 That's a persistent myth about some areas of the law I'm afraid - it applies to H&S Law but not Law of Negligence, for example. Either way, in this case we can't take any steps beyond removing software - and thereby the subject - from the curriculum...
mavhc Posted February 1, 2016 Posted February 1, 2016 But they can use MS Word to write a swear word, or MS Paint to draw a rude picture. Or just use a pen and paper. Or shout swear words out loud. How are you banning all those things? Oddly if you set a desktop via that command (or W version in python 3 (why aren't you using python 3?)), and read it back, I get test.jpg, but test.jpg is nowhere to be found in the registry, and there's no jpg files in c:\users\username or c:\windows, or c:\python34, so weird, can't find it with procman either
Ephelyon Posted February 1, 2016 Author Posted February 1, 2016 In a courtroom, the legal test for "toxic content" within the context of an office or classroom is likely to be passed by a hardcore pornographic image, but failed by "stickman porn" or individual instances of written or spoken profanity. Context and all that - I can provide more details if you want them but we'd be getting off-topic. PM me if you like, I have a very long debate you could read... I'm not sure about how exactly the wallpaper is set using that method - possibly the whole TranscodedWallpaper thing at a guess? As for Python 3, personally I think we should be using that exclusively though we currently have both 2.7 and 3.2 deployed. Our Head of ICT has asked that if we have to make a choice (such as if I deploy a VM with a single application if our workstations would magically work with it), we should stick with 2.7 as most of the resources he's prepared for exam revision etc are based on that. Don't ask me why... but it's his job, I'll obviously accept his choice!
mavhc Posted February 1, 2016 Posted February 1, 2016 Sigh, old python won't die. Anyway, for python 3.5, here's a dll that will block setting the wallpaper, to put in the python35 folder WallBlock.zip Written by Grégori Macário Harbs (Mysoft in the #winapi irc channel on freenode), soon to have a website at http://mytdt.com.br/FreebasicTemple Source code included, not yet tested as I have 3.4 installed currently 1
Ephelyon Posted February 1, 2016 Author Posted February 1, 2016 Ah, brilliant - many thanks for that! Now to see if I can crowbar our Head of ICT away from Python 2.7...
mavhc Posted February 1, 2016 Posted February 1, 2016 For school age use the only real issue is print "" vs print(""), and the fact that / works, only other thing I noticed was Tkinter vs tkinter package name. Python 3 Q & A — Nick Coghlan's Python Notes 1.0 documentation 1
ADMaster Posted February 4, 2016 Posted February 4, 2016 The problem is that this particular band action is of the type that can have consequences beyond school discipline. Just as it's possible to sue your employer if another employee has pornography on their screen and you can see it from across the office (and are "offended" by it, of course), so it is in school classrooms. It's an incredibly unlikely outcome, but as I said, now that they can change the desktop background it's only a matter of time one week before the bare naked ladies begin to appear... fixed this for you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now