I believe it has nothing to do with aviation and it looks very like what my father had one of these magic boxes made in Japan.
Strange though it may seem but it was a razor blade sharpener.
You put the old style double bladed razor blade in, closed the lid and moved the box up and down the cord, turn the blade over and repeat.
If the size is the same then that might be the answer. The magnets would collect any swarf.