Clear Clipboard

Share interesting information or links related to portable apps here.
Message
Author
User avatar
deathcubek
Posts: 221
Joined: Thu Jul 14, 2011 9:42 am
Location: Island of Lost Minds

Clear Clipboard

#1 Post by deathcubek »

ClearClipboard is a simple tool that will periodically clear your clipboard. This is useful, for example, to hide sensitive information, such as passwords. The clear timeout can be configured freely and defaults to 30 seconds. Also, the clipboard will not simply be cleared at a fixed interval. Instead, the clear timer will be reset every time that new content is copied to the clipboard. This ensures that only "stale" content will be cleared; recently copied content will never be cleared away.

Note: The ClearClipboard program runs "hidden" in the background. However, there will be an icon in the notification area, which can be used to control or terminate ClearClipboard. Only one instance of ClearClipboard can be running at a time.

clear_clipboard.jpg
clear_clipboard.jpg (65.55 KiB) Viewed 32439 times

Readme:
https://github.com/lordmulder/ClearClip ... troduction

Download:
https://github.com/lordmulder/ClearClip ... ses/latest

License:
Free and Open Source Software (MIT License)
Last edited by deathcubek on Thu Jun 06, 2019 11:31 am, edited 6 times in total.

Specular
Posts: 443
Joined: Sun Feb 16, 2014 10:54 pm

Re: Clear Clipboard

#2 Post by Specular »

I frequently clear the clipboard manually so this might be useful to me. Thanks.

User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

Re: Clear Clipboard

#3 Post by Cornflower »

The line
Nircmd.exe clipboard clear
does it for me

I personally don't like lots of batch files, so I placee it in a line in Famulus, which is always running on each of my machines.
in commands.dat
|clear|Nircmd.exe clipboard clear|||


Nircmd TPFC discussion link viewtopic.php?f=2&t=4288&hilit=nircmd

Famulus link https://www.portablefreeware.com/index.php?id=2265

User avatar
Midas
Posts: 6705
Joined: Mon Dec 07, 2009 7:09 am
Location: Sol3

Re: Clear Clipboard

#4 Post by Midas »

Nice tips, thanks. 8)

User avatar
deathcubek
Posts: 221
Joined: Thu Jul 14, 2011 9:42 am
Location: Island of Lost Minds

Re: Clear Clipboard

#5 Post by deathcubek »

Ding-A-Ling wrote: Wed May 29, 2019 3:16 am
deathcubek wrote: In any case, this seems like the sort of naive little program that almost anyone could write for himself in a scripting language like AutoIt.
With "almost anyone" you probably mean anyone with at least like some basic understanding of programming/scripting. And even those may prefer to not re-invent the wheel, if a tool that accomplishes the job already exists.

Anyhow, writing up a script that will clear your clipboard at a fixed interval of n seconds is easy enough - for a person who has some basic programming/scripting skills. But that's not really what we want here, because it could easily happen that the clipboard is cleared half a second after you just copied something. What we want – and what this program does – is to clear the clipboard after the content has not been updated/changed for a period of n seconds. That's something different!

Sure, it still is not rocket science, but it is not that "trivial" either. Requires some digging into the Win32 API in order to create a hidden window (that will receive the messages), register your window as a clipboard change listener, write up the message loop and so on.

And, if you want a nice shell notification icon (tray icon) for controlling things, then there is even more work to do.

(I don't know how much "AutoIt" could simply this process, but it feels like using a sledgehammer to crack a nut. AutoIt: 29,2 MB, ClearClipboard.exe: 31 KB)
Ding-A-Ling wrote: Wed May 29, 2019 3:16 amOh, and another thing occurs to me: it's hard to see password-protection as a "selling point" for this program as a decent password-manager would do this anyway and so much more. I am not sure about Keepass 1.xx but Keepass 2.xx offers: clipboard-clearing of sensitive data after a user-specified time-delay; drag-and-dropping of login details; autotyping of login details with the option of TCATO (two-channel autotype obfuscation) for security against keyloggers; and, of course, all the other things one might expect and need for password-management.
First of all, I'm not trying to "sell" anything. I created the program, in order to fulfill a need that I had. Decided to share it, in the hope that it might be useful for others too.

Anyhow, clearing the clipboard is a standard feature of password manages these days – but only for passwords that have been copied straight out of the password manager itself! I frequently Copy&Paste "sensitive" information from one place to another – such as configuration files, Excel sheets, encrypted emails in my email program, etc. pp. – during my daily work. So the clipboard cleaning feature of my password manager (which works as described) is not sufficient here – which is why I was looking for, and eventually wrote up, a solution.

Finally, if you are working in a team that has a long tradition of storing passwords as plaintext files wrapped in TrueCrypt containers, then whatever great features Keepass & Co have to offer aren't really helpful :wink:
Ding-A-Ling wrote: Wed May 29, 2019 3:16 amIf an intention of the program is to reduce the exposure of sensitive information such as passwords to clipboard-spying, does it have a sensible option to only clear the clipboard if it contains purely textual data?
Not yet. But I think this might be a useful addition – at least as an option. I will have to look if and how it is possible to implement...
Last edited by deathcubek on Sun Jun 02, 2019 3:26 am, edited 6 times in total.

User avatar
deathcubek
Posts: 221
Joined: Thu Jul 14, 2011 9:42 am
Location: Island of Lost Minds

For whom it may interest…

#6 Post by deathcubek »

Clear Clipboard v1.04
https://github.com/lordmulder/ClearClip ... s/tag/1.04
What's New v1.04 [2019-06-01]
  • Optionally restrict the automatic clearing to textual data. Use parameter TextOnly to configure.
  • Some fixes and improvements.
What's New v1.03 [2019-05-31]
  • Added shell notification icon that can be used to control the Clear Clipboard program.
  • Clipboard can be cleared manually by double-click on the shell notification icon or from the context menu.
  • Optionally, a sound file can be played whenever the clipboard is cleared.
  • Automatic clipboard clearing can now be halted (suspended) or resumed at any time via the context menu.
  • The additional configuration parameters Sound and Halted are supported now.
  • Show message when "autorun" entry has been created or removed. Use option --silent to suppress.
  • Detection of "problematic" Windows 10 features (Clipboard History and Cloud Clipboard Sync)
  • Added "x64" (64-Bit) binaries of the ClearClipboard program. Note: Requires 64-Bit Windows edition to run.
  • Some fixes and improvements.

    User avatar
    webfork
    Posts: 10818
    Joined: Wed Apr 11, 2007 8:06 pm
    Location: US, Texas
    Contact:

    Re: Clear Clipboard

    #7 Post by webfork »

    deathcubek wrote:Clear Clipboard is a simple tool that will periodically clear your clipboard. This is useful, for example, to hide sensitive information, such as passwords.
    Thanks for submitting -- I tend to prefer smaller, configurable programs versus larger tools and I rarely need my active clipboard for more than a few minutes. Anything beyond that is a security risk.
    Ding-A-Ling wrote:In any case, this seems like the sort of naive little program that almost anyone could write for himself in a scripting language like AutoIt.
    As I don't know how to do that, I welcome a tool like this.

    User avatar
    deathcubek
    Posts: 221
    Joined: Thu Jul 14, 2011 9:42 am
    Location: Island of Lost Minds

    Re: Clear Clipboard

    #8 Post by deathcubek »

    Clear Clipboard v1.06
    https://github.com/lordmulder/ClearClip ... s/tag/1.06
    What's New v1.06 [2019-06-05]
    • Optional system-wide hotkey to immediately clear the clipboard. Use parameter Hotkey to configure.
    • Allow more fine-grained control of diagnostic output.
    • Some fixes and improvements.
    What's New v1.05 [2019-06-02]
    • Detect whether the Windows 10 "Clipboard History" service is running, and if so, suggest to disable.
    • Some fixes and improvements.

    User avatar
    webfork
    Posts: 10818
    Joined: Wed Apr 11, 2007 8:06 pm
    Location: US, Texas
    Contact:

    Re: Clear Clipboard

    #9 Post by webfork »

    Some screenshots:

    Launch:
    Image

    From tray
    Image

    User avatar
    deathcubek
    Posts: 221
    Joined: Thu Jul 14, 2011 9:42 am
    Location: Island of Lost Minds

    Just a minor update

    #10 Post by deathcubek »

    Clear Clipboard v1.07-1
    https://github.com/lordmulder/ClearClip ... tag/1.07-1
    What's New v1.07 [2019-06-15]
    • Slightly improved detection of "textual" data on the clipboard.
    • Implemented detection of "Ditto", a popular clipboard manager for Microsoft Windows.
    • Some fixes and improvements.

    User avatar
    webfork
    Posts: 10818
    Joined: Wed Apr 11, 2007 8:06 pm
    Location: US, Texas
    Contact:

    Re: Just a minor update

    #11 Post by webfork »

    deathcubek wrote: Sun Jun 16, 2019 6:44 am Implemented detection of "Ditto", a popular clipboard manager for Microsoft Windows.
    That's my copy manager of choice. What does detection do? Just disable "Clear Clipboard" while the program is running?

    User avatar
    deathcubek
    Posts: 221
    Joined: Thu Jul 14, 2011 9:42 am
    Location: Island of Lost Minds

    Re: Just a minor update

    #12 Post by deathcubek »

    webfork wrote: Sun Jun 16, 2019 11:22 am
    deathcubek wrote: Sun Jun 16, 2019 6:44 am Implemented detection of "Ditto", a popular clipboard manager for Microsoft Windows.
    That's my copy manager of choice. What does detection do? Just disable "Clear Clipboard" while the program is running?
    Nope, it shows a warning message when "Ditto" is found to be running on your system.

    That is because, similar to the Windows 10 "Clipboard History" feature, the "Ditto" program will keep a history of everything that was copied to clipboard – and we can't clear that (at least I don't know how to do it, or if it even would be desired).

    Of course, the warning can be disabled in the configuration file.

    User avatar
    webfork
    Posts: 10818
    Joined: Wed Apr 11, 2007 8:06 pm
    Location: US, Texas
    Contact:

    Re: Clear Clipboard

    #13 Post by webfork »

    deathcubek wrote: Sun Jun 16, 2019 1:25 pm Nope, it shows a warning message when "Ditto" is found to be running on your system.
    Makes sense, thanks.

    User avatar
    __philippe
    Posts: 687
    Joined: Wed Jun 26, 2013 2:09 am

    Re: Clear Clipboard

    #14 Post by __philippe »

    After more years i care to remember mucking around Win XP and consorts,
    it finally dawned on me the clipboard can be can cleared in a one liner CLI swoop... :roll:

    Code: Select all

    echo off | clip 

    User avatar
    Andrew Lee
    Posts: 3048
    Joined: Sat Feb 04, 2006 9:19 am
    Contact:

    Re: Clear Clipboard

    #15 Post by Andrew Lee »

    __philippe wrote: Sun Nov 21, 2021 9:37 am After more years i care to remember mucking around Win XP and consorts,
    it finally dawned on me the clipboard can be can cleared in a one liner CLI swoop... :roll:

    Code: Select all

    echo off | clip 
    I don't think I have any practical use for this, but it is a really cool hack that I am hearing for the first time :D

    Amazingly, I tried it and it works!

    Post Reply